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
 

Some videos you may like

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

gramit

Board Regular
Joined
Jan 8, 2010
Messages
158
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:

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
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
 

Aussie Grid

New Member
Joined
Jan 14, 2010
Messages
47
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
 

Watch MrExcel Video

Forum statistics

Threads
1,123,517
Messages
5,602,124
Members
414,505
Latest member
quoctrungvu99

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
Top