-
Solved: Using Object by calling a variable
I have searched the boards, but....
I have over 100 textbox objects on my form. Call them txt0, txt1, txt2, etc...
Depending on the data in a table and how it plays together, various combinations could refer to txt25, etc. The combinations are endless. However, In can easily manipulate them into numbers. What I need to do is refer to a specific textbox. example:
"txt" & str(25) = txt25 which is the textbox I want to use.
How can I create a variable, initialize it to "txt25" and then use it to call the object txt25?
I have tried
dim myObj as new textbox
dim strObj as string
strObj = "txt25"
A little help please
-
lets say you have your number and assign it to variable i
then you could use something like
[VBA]UserForm1.Controls("txt" & i).SetFocus[/VBA]
K :-)
-
I knew I could get a reply from this board. thanks a lot, it works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules