Forum Discussion
AvengerArts
Jul 12, 2019Copper Contributor
Index/Match in vba code
Hello, 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 ta...
Berndvbatanker
Jul 12, 2019Iron Contributor
Hi,
i managed it with the following code. See attached file, too.
Private Sub TextBox1_Change()
Dim rngCol As Range
Dim rngCell As Range
Set rngCol = Tabelle1.Range("Tabelle1[Name]")
rngCol.Interior.ColorIndex = xlNone
For Each rngCell In rngCol
If rngCell.Value = Me.TextBox1.Value Then
Me.TextBox2.Value = rngCell.Offset(0, -1).Value
End If
Next rngCell
End Sub
Best regards
Bernd
https://vba-tanker.com/
AvengerArts
Jul 12, 2019Copper Contributor
Thanks, I was hoping to use the method I provided, but you made it simple though I tried to apply it but I get an error!
could you help?
I'm not a programmer but I'm trying to learn!