Is it possible to add a button to show/hide a picture in a worksheet?
Is it possible to add a button to show/hide a picture in a worksheet?
notchristopher,
Welcome to the forum. Please read forum rules below before posting again.
Your thread moved to programming
Try something like. Change picture 1 to your picture name
VBA Noob![]()
ActiveSheet.Shapes("Picture 1").Visible = False
_________________________________________
![]()
![]()
Credo Elvem ipsum etian vivere
_________________________________________
A message for cross posters
Please remember to wrap code.
Forum Rules
Please add to your signature if you found this link helpful. Excel links !!!
my bad thanks
can you fix this for me please? not a coder..
![]()
Sub Button1_Click() If Visible("Units-1.JPG") = True Then ActiveSheet.Shapes("Units-1.JPG").Visible = False Else ActiveSheet.Shapes("Units-1.JPG").Visible = True End Sub
You need to test the visibility of the shape before changing it.
So rather than your test of Visible() use the same references to the sheet and shape.
![]()
Sub Button1_Click() If ActiveSheet.Shapes("Units-1.JPG").Visible = True Then ActiveSheet.Shapes("Units-1.JPG").Visible = False Else ActiveSheet.Shapes("Units-1.JPG").Visible = True End Sub
Or
or![]()
ActiveSheet.Shapes("Units-1.JPG").Visible = _ Not ActiveSheet.Shapes("Units-1.JPG").Visible
VBA Noob![]()
With ActiveSheet.Shapes("Units-1.JPG") .Visible = Not .Visible End With
Last edited by VBA Noob; 09-14-2008 at 08:09 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks