Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command buttons

Status
Not open for further replies.

vedicman

Programmer
Sep 5, 2003
128
US
I have seven command buttons pasted on a sheet called Data. The button names are cmd1, cmd2, cmd3, etc. Rather than referring to each button directly, I'm trying to do something like this:

in a loop I have the following:

Set oCmd = cmd & i
ocmd.Enabled = true

This is not working. Any ideas would be appreciated.

Thanks.....Franco
 
Set oCmd = Me.Controls("cmd" & i)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Oops, sorry. :~/
Please, disregard my previous post as your buttons are in a sheet.
 
How about:

ActiveSheet.OLEObjects("CommandButton" & i).Enabled = True

Cheers, Glenn.

Did you hear about the literalist show-jumper? He broke his nose jumping against the clock.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top