Hide/Unhide control all sheets.

Aussie Grid

New Member
Joined
Jan 14, 2010
Messages
47
This code is perfect but I would like it to perform on all sheets, rather than just the active.

Sub Shapes2()
'Loop through the Shapes collection and use the Type number of the control
Dim myshape As Shape
For Each myshape In ActiveSheet.Shapes

' ActiveX control (control toolbox) or a linked or embedded OLE object.
If myshape.Type = 12 Then myshape.Visible = False


Next myshape
End Sub

Any & all help appreciated.
Aussie Grid
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Code:
Sub Shapes2()
Application.Screenupdating = False
Dim WS as Worksheet, myshape As Shape
For Each WS in Worksheets
WS.Activate
'Loop through the Shapes collection and use the Type number of the control
    For Each myshape In ActiveSheet.Shapes
 
        ' ActiveX control (control toolbox) or a linked or embedded OLE object.
        If myshape.Type = 12 Then myshape.Visible = False

 
    Next myshape
Next WS
Application.Screenupdating = True
End Sub
 
Last edited:
Upvote 0
Try

Code:
Sub Shapes2()
'Loop through the Shapes collection and use the Type number of the control
Dim myshape As Shape, ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
    For Each myshape In ws.Shapes
        ' ActiveX control (control toolbox) or a linked or embedded OLE object.
        If myshape.Type = 12 Then myshape.Visible = False
    Next myshape
Next ws
End Sub
 
Upvote 0
Thank you Gramit and VOG for your speedy replies they both work beautifully. The speed award must go to Gramit though. I hit "Post" logged out, looked at forum and couldn't believe my eyes when I saw a reply. Must have been all of 30 seconds.Then by the time I'd read that Vog's was there. Extremely impressive!:biggrin:
Again thank you both very much.

Aussie Grid
 
Upvote 0

Forum statistics

Threads
1,213,530
Messages
6,114,163
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top