Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default CommandButton as array ?

Hello Everyone,
I am developing an application that having 140 command
button....i want to set font size on every command button to 10 in
single click. is is possible for me to use array and DO Until loop for
this task...what i have done is like below but it showing error..

================================================== ==================================
Dim CommandButton(1 To 140) As Integer

Private Sub CommandButton1_Click()
Dim x As Integer
Dim fun As Variant

x = 0

Do Until x = 140

x = x + 1
commandbutton(x).Font.Size = 10

Loop

End Sub
================================================== =================================

What is the problem with above code ? i cant get it to work...is there
anyone have any idea ?

regards,
Aisar
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,549
Default CommandButton as array ?

In your blinking button post you show some button code that apparently works.
In it you refer to the buttons as "ActiveSheet.Buttons("Button 1")".

Try using the same syntax in your Do loop... ActiveSheet.Buttons("Button " & x)
--
Jim Cone
Portland, Oregon USA .
http://www.mediafire.com/PrimitiveSoftware .
(Data Rows Excel add-in: Color rows, Delete rows, Insert rows)



"apis"
wrote in message
...
Hello Everyone,
I am developing an application that having 140 command
button....i want to set font size on every command button to 10 in
single click. is is possible for me to use array and DO Until loop for
this task...what i have done is like below but it showing error..

==============================================
Dim CommandButton(1 To 140) As Integer

Private Sub CommandButton1_Click()
Dim x As Integer
Dim fun As Variant

x = 0

Do Until x = 140

x = x + 1
commandbutton(x).Font.Size = 10

Loop

End Sub
===============================================

What is the problem with above code ? i cant get it to work...is there
anyone have any idea ?

regards,
Aisar



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default CommandButton as array ?

On Nov 17, 10:22*am, "Jim Cone" wrote:
In your blinking button post you show some button code that apparently works.
In it you refer to the buttons as "ActiveSheet.Buttons("Button 1")".

Try using the same syntax in your Do loop... ActiveSheet.Buttons("Button " & x)
--
Jim Cone
Portland, Oregon USA *.http://www.mediafire.com/PrimitiveSoftware*.
(Data Rows Excel add-in: Color rows, Delete rows, Insert rows)

"apis"
wrote in ...







Hello Everyone,
* * I am developing an application that having 140 command
button....i want to set font size on every command button to 10 in
single click. is is possible for me to use array and DO Until loop for
this task...what i have done is like below but it showing error..


==============================================
Dim CommandButton(1 To 140) As Integer


Private Sub CommandButton1_Click()
Dim x As Integer
Dim fun As Variant


x = 0


Do Until x = 140


x = x + 1
commandbutton(x).Font.Size = 10


Loop


End Sub
===============================================


What is the problem with above code ? i cant get it to work...is there
anyone have any idea ?


regards,
Aisar


Why in the world would you want 140 command buttons. Surely there is a
better way.
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
Floating a CommandButton Ayo Excel Discussion (Misc queries) 2 June 2nd 08 08:08 PM
CommandButton self reference makulski Excel Worksheet Functions 0 March 27th 08 02:37 PM
Hide commandbutton? capt Excel Discussion (Misc queries) 2 February 21st 08 07:40 PM
Tooltip for my CommandButton LQs Excel Discussion (Misc queries) 1 December 2nd 05 09:53 AM
CommandButton - Userform Marcia3641 Excel Discussion (Misc queries) 2 July 21st 05 06:39 PM


All times are GMT +1. The time now is 06:19 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"