PDA

View Full Version : Solved: Evaluate("INDEX vs Application.Index



white_flag
09-10-2012, 05:56 AM
Hello

I am trying to transform this line:


For Each dPart In Evaluate("INDEX(" & Me.ComboBox1.Value & ", , 1)")

to replace Evaluate("INDEX(" with Application.WorksheetFunction.Index( Me.Combobox1, ,1) 'not working

can someone help me to put this in a correct way
thank you

Aflatoon
09-10-2012, 06:53 AM
You need:
Application.WorksheetFunction.Index(Sheets("some sheet").Range(Me.Combobox1), 0,1)

white_flag
09-10-2012, 07:07 AM
but combobox1 has a collection of dynamic name of ranges (rang1, rang2, etc). so normally you do not need to add the Sheets"name".range etc ... or I am wrong?

Aflatoon
09-10-2012, 07:16 AM
It depends where your code is located. You may be able to simply use:
Application.WorksheetFunction.Index(Application.Range(Me.Combobox1), 0,1)

white_flag
09-11-2012, 03:12 AM
yes, you are correct!It is working :) thank you