Hi Everyone, and happy new year!!
Can you do a loop in VBA to check all the 'A' cells in rows 1 through 100 (for example) until it finds the right cell?
Let's say in Excel A1 = 10, A2 = 20, A3 = 30, ....A10 = 100
User enters 30 in the VBA form and I want the program to figure out that A3 = 30, and therefore the answer is B3.
This is the code I would use without a loop.
Sub ExcelRowCheck()
blah = TextBox1
Sheets("Sheet1").Select
If blah = Range("A1") Then booh = Range("B1")
ElseIf blah = Range("A2") Then booh = Range("B2")
etc.
etc.
etc.
End If
End Sub
But as you can see, this would be a nightmare if I wanted to crosscheck 100+ cells. Can you run a loop where 'X' was the number of loops and it checks all A(X)?
Hope that makes sense!
Thank you!
Kala