PC Review


Reply
Thread Tools Rate Thread

Array Declaration.

 
 
apis
Guest
Posts: n/a
 
      5th Nov 2011
Hello everyone,
I was developing one excel programming, i have 100 button in one
sheet. can i used array to assign the button visibility = TRUE using
array ? I am very new to VBA. My last programming language i learn was
C++ and it was 12 years ago..Now i am sort of refreshing everything..

regards,
Aisar Apis
 
Reply With Quote
 
 
 
 
James Ravenswood
Guest
Posts: n/a
 
      5th Nov 2011
On Nov 5, 7:38*am, apis <aisar...@gmail.com> wrote:
> Hello everyone,
> * * *I was developing one excel programming, i have 100 button in one
> sheet. can i used array to assign the button visibility = TRUE using
> array ? I am very new to VBA. My last programming language i learn was
> C++ and it was 12 years ago..Now i am sort of refreshing everything..
>
> regards,
> Aisar Apis


Sure. If you put, say, Forms Buttons on a sheet you can treat the as
shapes:

Sub buttonHider()
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
MsgBox sh.Name
Next
ary = Array("Button 1", "Button 2")
n = Application.InputBox(prompt:="enter button index", Type:=1)
Set sh = ActiveSheet.Shapes(n)
sh.Visible = msoFalse

End Sub

use 1 rather than 0 for the first buttton
 
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 04:32 PM.