PC Review


Reply
Thread Tools Rate Thread

CommandButton as array ?

 
 
apis
Guest
Posts: n/a
 
      17th Nov 2011
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
 
Reply With Quote
 
 
 
 
Jim Cone
Guest
Posts: n/a
 
      17th Nov 2011
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" <(E-Mail Removed)>
wrote in message
news:1602dda2-0bf8-43a6-8dd9-(E-Mail Removed)...
> 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



 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      17th Nov 2011
On Nov 17, 10:22*am, "Jim Cone" <james.cone...@comcast.netXxx> 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" <aisar...@gmail.com>
> wrote in messagenews:1602dda2-0bf8-43a6-8dd9-(E-Mail Removed)...
>
>
>
>
>
>
>
> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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



Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:05 PM.