ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variables & strings (https://www.excelbanter.com/excel-programming/407368-variables-strings.html)

Tanya

Variables & strings
 
I have multiple commandbuttons on a single sheet and I wish to make them all
visible
Do I have to list each button as follows, or can I use a string?

CommandButton1.Visible = True

cheers
Tanya

Rick Rothstein \(MVP - VB\)[_1402_]

Variables & strings
 
Assuming that sheet is Sheet1...

Sub MakeCommandButtonsVisible()
Dim Obj As Object
For Each Obj In Worksheets("Sheet1").OLEObjects
Obj.Visible = True
Next
End Sub

If you want to do this to the active sheet instead of a specific sheet, just
substitute ActiveSheet for the Worksheets("Sheet1") reference.

Rick


"Tanya" wrote in message
...
I have multiple commandbuttons on a single sheet and I wish to make them
all
visible
Do I have to list each button as follows, or can I use a string?

CommandButton1.Visible = True

cheers
Tanya



Tanya

Variables & strings
 
Thank you Rick,
Worked a charm.

Regards
Tanya

"Rick Rothstein (MVP - VB)" wrote:

Assuming that sheet is Sheet1...

Sub MakeCommandButtonsVisible()
Dim Obj As Object
For Each Obj In Worksheets("Sheet1").OLEObjects
Obj.Visible = True
Next
End Sub

If you want to do this to the active sheet instead of a specific sheet, just
substitute ActiveSheet for the Worksheets("Sheet1") reference.

Rick


"Tanya" wrote in message
...
I have multiple commandbuttons on a single sheet and I wish to make them
all
visible
Do I have to list each button as follows, or can I use a string?

CommandButton1.Visible = True

cheers
Tanya





All times are GMT +1. The time now is 04:27 AM.

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