View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PCLIVE PCLIVE is offline
external usenet poster
 
Posts: 1,311
Default Using a variable to select a CommandButton and setting the caption

I'm using a CommandButton from the Control Toolbox. How can I access this
control via VBA using a Variable.

Example:
i=1

I have CommandButton1.

I'd like to set the caption of CommandButton1 use the "i" variable for the
number of that CommandButton. I've done this before with a button on a
UserForm using something like:

UserForm3.Controls("CommandButton" & i).Caption = "Test"

So how can I do this with a CommandButton that is not on a UserForm?

Thanks,
Paul



--