-
Solved: user form control problem - using names in loop
Hi everyone,
I do not know if what i am trying to do is possible but if it is, i am sure there is a very simple answer out there. Here's what i want to do:
I have created a user form and added several command buttons to it at design time. Let's say their names are cmdBtn1, cmdBtn2, ... , cmdBtn9.
I want to be able to use the names in a loop to assign a caption to the relative command button.
eg. cmdBtn(count).caption = range("A" & count).value
is there any way to concatenate the first part of the name "cmdBtn" with a variable integer "count" and use it in the form above?
maybe there is a simpler way around this...????
-
Something like this, perhaps?
[VBA] For Counter = 1 To 9
Me.Controls("cmdBtn" & Counter).Caption = Range("A" & Counter)
Next
[/VBA]
-
matthewspatrick,
thanks for that...works perfectly...just what i was after.
-
Glad to be of service
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