Hiding multiple pictures

diatex

Board Regular
Joined
Jan 16, 2004
Messages
96
The code below was supplied by Tommygun in a previous post and enables a picture to be hidden by the use of a toggle button, i have been playing about with it trying to hide multiple pictures (2 or 3) but without any success. Would each picture require its own button?? any pointers most welcome.
Sub HidePicture()
Dim v As Boolean
v = ActiveSheet.Shapes("Object 1").Visible
ActiveSheet.Shapes("Object 1").Visible = Not v
End Sub

Thanks Diatex
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

DRJ

MrExcel MVP
Joined
Feb 17, 2002
Messages
3,853
Try this:

Code:
Sub HidePicture() 
Dim v As Boolean 
    v = ActiveSheet.Shapes("Object 1").Visible 
    ActiveSheet.Shapes("Object 1").Visible = Not v 
    ActiveSheet.Shapes("Object 2").Visible = Not v 
    ActiveSheet.Shapes("Object 3").Visible = Not v 
End Sub

Assuming those are the objects you want to hide, modify as needed.
 

Watch MrExcel Video

Forum statistics

Threads
1,123,304
Messages
5,600,862
Members
414,409
Latest member
FloordAlex

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