1

I have a problem using the lookup function in userforms in vba

what I want is return value from a table using vlookup as the value of lookup is string and the end result is integer

I am using this and now working but it is working with another table which contain only numerics; but not working with a table contain texts (Arabic text ) .

Private Sub ComboBox3_Change()
Dim x As String


x = Me.ComboBox3.Value
Me.TextBox5.Value = Application.WorksheetFunction.VLookup(x,
                    Worksheets("masterfile").Range("pricerange"), 2, False)     

End Sub

kindly help me

bonCodigo
  • 14,268
  • 1
  • 48
  • 91
  • This [answer might be of some value to you](https://stackoverflow.com/q/18868029/1389394). Could you let us know if you do a test vlookup for English text in your combobox if your function works. – bonCodigo May 04 '23 at 13:00
  • 1
    sorry for that i dont know what happened but its working now with the below code as i deleted all text boxes and made from start . Private Sub item1_Change() Dim x As String x = Me.item1.Value Me.TextBox1.Value = Application.WorksheetFunction.VLookup(x, Worksheets("masterfile").Range("pricerange"), 2, False) End Sub – Mahmoud Mahmad May 04 '23 at 13:32
  • Then you can post that as an answer. Make sure you indicate in your answer that it's working for Arabic text and that you have tested it. – bonCodigo May 04 '23 at 14:35

1 Answers1

0

sorry for that i dont know what happened but its working now with the below code as i deleted all text boxes and made from start .

 Private Sub item1_Change() Dim x As String x = Me.item1.Value Me.TextBox1.Value = Application.WorksheetFunction.VLookup(x, Worksheets("masterfile").Range("pricerange"), 2, False) End Sub