kerrywayne
New Member
- Joined
- Jul 21, 2023
- Messages
- 10
- Office Version
- 2003 or older
- Platform
- Windows
I am trying to use a index to cycle through multiple command buttons inside a user form. I want to be able to refer to each button as "CommandButton" & number as the button names. The button .captions are stored in an array and I want to use a For Next loop the assight the captions to the command buttons. Is this doable without getting into ole coding? I have 88 command buttons.
I found the below code with Google search..
Dim bt As MSForms.CommandButton
Set bt = ActiveSheet.OLEObjects("Bridge_cmdbutton" & Number).Object
bt.Caption = "Some Descriptive Text"
At Least 2 problems: 1) my command buttons are not OLEObjects, 2) I am not inside a worksheet.
I found the below code with Google search..
Dim bt As MSForms.CommandButton
Set bt = ActiveSheet.OLEObjects("Bridge_cmdbutton" & Number).Object
bt.Caption = "Some Descriptive Text"
At Least 2 problems: 1) my command buttons are not OLEObjects, 2) I am not inside a worksheet.