I need to know the index number for a certain name, for example when I write in TextBox1 = Sara, and click the button, Then TextBox2 should return index value opposite to that name in the table (Table1)
I tried INDEX/Match method on cell sheet, and it worked, but i tried translating it to a vba code, but I get msgbox saying
Run time 1004 Unable to get the match property of the worksheetFunction class.
my code was
Private Sub CommandButton1_Click()
Dim tbl As ListObject
Set tbl = Sheet1.ListObjects("Table1")
TextBox2.Value = Application.WorksheetFunction.Index(Sheet1.tbl.ListColumns(1), Application.WorksheetFunction.Match(TextBox1.Value, tbl.ListColumns(2), 0), 1)
End Sub
I want TextBox2 to return the index number on the table, If I write "Sam" on TextBox1, then TextBox2 should show 3.

