Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default excel VBA set array controls

I need to address with a variable a large array of User Form Command Buttons

Dim Mybutton(5) As CommandButton

Set Mybutton(1) = CommandButton1
Set Mybutton(2) = CommandButton2
Set Mybutton(3) = CommandButton3
Set Mybutton(4) = CommandButton4
Set Mybutton(5) = CommandButton5
and so on........

so later I can use Mybutton(x).caption = "whatever"

Surly there is a way to set the array with something like.

for x = 1 to 100
Set Mybutton(x)= CommandButton & (x)
next x


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default excel VBA set array controls

Hi Jason,

How about this:

for x = 1 to 100
Set Mybutton(x)= Controls("CommandButton" & x)
next x

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Jason" wrote in message
...
I need to address with a variable a large array of User Form Command

Buttons

Dim Mybutton(5) As CommandButton

Set Mybutton(1) = CommandButton1
Set Mybutton(2) = CommandButton2
Set Mybutton(3) = CommandButton3
Set Mybutton(4) = CommandButton4
Set Mybutton(5) = CommandButton5
and so on........

so later I can use Mybutton(x).caption = "whatever"

Surly there is a way to set the array with something like.

for x = 1 to 100
Set Mybutton(x)= CommandButton & (x)
next x




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controls not available in Excel. Infoman Excel Discussion (Misc queries) 0 November 20th 07 07:16 PM
Controls in Excel 2007 Pat Excel Discussion (Misc queries) 1 August 20th 07 05:02 AM
ActiveX Controls vs Form Controls Alex Excel Discussion (Misc queries) 1 January 11th 06 08:46 AM
Help on Excel controls Reney Langlois Excel Discussion (Misc queries) 1 March 9th 05 02:48 PM
Controls in Excel esr Excel Programming 0 June 4th 04 08:36 PM


All times are GMT +1. The time now is 07:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"