Variables & strings

T

Tanya

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
 
R

Rick Rothstein \(MVP - VB\)

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
 
T

Tanya

Thank you Rick,
Worked a charm.

Regards
Tanya

Rick Rothstein (MVP - VB) said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top