Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Commandbutton Caption
I have 26 commandbuttons on Sheet2. I created each by copy & paste. This
caused the caption to be Commandbutton1 on all 26. I thought the following code would change each, but it is not working. I get the following error and the "&" sign is highlighted: Compile Error Expected: expression Here is the code: Private Sub CommandButton27_Click() Worksheets("Sheet2").Active For k = 2 To 26 Commandbutton & k.Caption = "Commandbutton"&k End Sub Les |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Commandbutton Caption
Maybe using this method.
For k = 2 To 26 ActiveSheet.OLEObjects("Commandbutton" & (k)).Object.Caption = "Commandbutton" & k Next HTH, Paul -- "WLMPilot" wrote in message ... I have 26 commandbuttons on Sheet2. I created each by copy & paste. This caused the caption to be Commandbutton1 on all 26. I thought the following code would change each, but it is not working. I get the following error and the "&" sign is highlighted: Compile Error Expected: expression Here is the code: Private Sub CommandButton27_Click() Worksheets("Sheet2").Active For k = 2 To 26 Commandbutton & k.Caption = "Commandbutton"&k End Sub Les |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
CommandButton Caption Anomily | Excel Programming | |||
Commandbutton caption change | Excel Programming | |||
Caption disappears from CommandButton. | Excel Programming | |||
Change CommandButton Caption | Excel Programming | |||
CommandButton.Caption | Excel Programming |