Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
For x = 1 To 20 ProjectForm.Controls("Button" & x).Caption = Sheet1.Cells(2, x + 2) Next x I'm assuming "Button" refers to the commandbutton object names, not the current caption(s). Unless they changed it in subsequent versions, VBA's default name for its commandbuttons are CommandButton1, CommandButton2, etc. If you get an object not found error - you'll need to verify this. "Cory" wrote: I have a userform with a number of Command Buttons (Button1, Button2, etc...). Before the form loads, I would like to change the caption of each of the buttons (with the use of a loop) to the contents of certain cells. Can anyone help me with the syntax is to do so. For example: For x = 1 to 20 ProjectForm.("Button" & x).Caption = Sheet1.Cells(2, x + 2) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
refering to worksheet cell under shaoe object | Excel Programming | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming | |||
refering to a range with a variable | Excel Programming | |||
Simple problem refering to variable in For ... Next loop ... | Excel Programming |