ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Array Declaration. (https://www.excelbanter.com/excel-discussion-misc-queries/270620-array-declaration.html)

apis

Array Declaration.
 
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

James Ravenswood

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


All times are GMT +1. The time now is 01:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com