helloakshay
New Member
I am selecting a value in the combo box and doing a vlookup for 3 column.
The value in the combobox is in Text format.
Example value selected in a combo box is "New York" the value in its column 3 is some 200 /300. so it should show this value.
I know vlookup has some issues while searching with values in text format. hence i have used Trim in vba code still it throws the error.
My range is named "country"
is it ideal to use a vlookup r index and match function here
The value in the combobox is in Text format.
Example value selected in a combo box is "New York" the value in its column 3 is some 200 /300. so it should show this value.
I know vlookup has some issues while searching with values in text format. hence i have used Trim in vba code still it throws the error.
My range is named "country"
is it ideal to use a vlookup r index and match function here
Code:
'Range("B3:N11") Named as Country
Dim x As Variant
Dim y As Variant
Dim z As String
x = ComboBox1.Value
MsgBox x
y = Application.WorksheetFunction.VLookup(Trim(x), Range("$B$3:$N$11"), 3)
Range("e14").Value = y
End Sub