View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
donwb donwb is offline
external usenet poster
 
Posts: 81
Default Programatically click CommandButton

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