In my module, I have some textboxes: textbox1, textbox2, textbox3,etc. I want to create a loop to test each of these textboxes and need to refer to them.
for i = 1 to numberofTextbox
if userform1.textbox & i.value = "something" then
' do things
End if
next i
I tried to this but it doesn't work:
for i = 1 to numberofTextbox
if Controls("userform1.Textbox" & i).value = "something" then
..
...
How to do this in a loop so I don't have to explicitly test for each Textbox?
for i = 1 to numberofTextbox
if userform1.textbox & i.value = "something" then
' do things
End if
next i
I tried to this but it doesn't work:
for i = 1 to numberofTextbox
if Controls("userform1.Textbox" & i).value = "something" then
..
...
How to do this in a loop so I don't have to explicitly test for each Textbox?