Array Declaration.
On Nov 5, 7:38*am, apis 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
|