Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Leith
Many thanks for the code. It does just what I want - just needed a full stop before "Controls" Thanks to everyone who helped me with this including Dave's suggestion. donwb "Leith Ross" wrote in message ... On Mar 15, 12:52 pm, FSt1 wrote: hi incorrect syntax. what are you trying to pass to the procedure? variables can be passed but the call command is looking for a named procedure and what you have written is not a named prodedure. UserForm1.CommandButton1_Click is your named prodedure. UserForm1.CommandButton(X)_Click is not. the correct syntax would be..... call UserForm1.CommandButton1_Click () you can pass variables, arrays or expressions but they have to be within the parenthases. but i'm not too sure about a button number. what are you trying to do...call 5 different button click? regards FSt1 "donwb" wrote: The following expression works fine and clicks CommandButton #1:- Call UserForm1.CommandButton1_Click Is it possible to assign a variable to the number of the button clicked, along the lines:- For X=1 to 5 step 1 Call UserForm1.CommandButton(X)_Click (Then does what clicking the CB does) Next X This doesn't work, but I don't know if the fault is incorrect syntax, or that the expression simply cannot take a variable. donwb Hello Donwb, You can Click each Command Button by setting its value property to true, like this... Dim CmdBtn As Object For X=1 to 5 step 1 Set CmdBtn = Controls("CommandButton" & X) CmdBtn.Value = True Next X Sincerely, Leith Ross |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
after click a button(commandbutton), getting the button name | Excel Programming | |||
Capture/Passing Commandbutton click | Excel Programming | |||
DTPicker Control: Can you programatically fire the click event? | Excel Programming | |||
Click on graph bar to execute a double-click in a pivot table cell | Charts and Charting in Excel | |||
Mouse Over Graph, Capture Information on Click(Double Click) | Excel Programming |