how to use the same button for image dispaly and hiding the image

kailashramuu

New Member
Joined
May 3, 2011
Messages
13
Hi..


Can anyone help me to display a image when we click on the button and that image should disappear when we again click on the same button.


Pls.....


Regards
Kailash
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG16May13
[COLOR="Navy"]With[/COLOR] ActiveSheet.Shapes("Picture 2")
    .Visible = Not .Visible
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]With[/COLOR]
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
It's name of Shape object containing your picture. When you select image, the name appears on the left side of formula bar.
 
Upvote 0
sorry ,


i will explain my requirement full..


I want to display the graph chart of every month in a sheet..

For this.. When i click on jan BUTTON It should DISPLAY jan chart then if i click on Feb BUTTON it should display the feb chart but it should disappear that jan chart.


Thanks And REgards
Kailash
 
Upvote 0
You could use something like this for each Chart Button.
Code:
[COLOR="Navy"]Sub[/COLOR] MG16May32
[COLOR="Navy"]Dim[/COLOR] Cht [COLOR="Navy"]As[/COLOR] ChartObject
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Cht [COLOR="Navy"]In[/COLOR] ActiveSheet.ChartObjects
'[COLOR="Green"][B]If Cht.Name = "Chart 4" Then'Option for Chart Name[/B][/COLOR]
[COLOR="Navy"]If[/COLOR] Cht.Chart.ChartTitle.Characters.text = "Jan" [COLOR="Navy"]Then[/COLOR]
    Cht.Visible = True
[COLOR="Navy"]Else[/COLOR]
    Cht.Visible = False
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Cht
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Try:-
Code:
[COLOR=Navy]Sub[/COLOR] MG16May13
[COLOR=Navy]With[/COLOR] ActiveSheet.Shapes("Picture 2")
    .Visible = Not .Visible
[COLOR=Navy]End[/COLOR] [COLOR=Navy]With[/COLOR]
[COLOR=Navy]End[/COLOR] [COLOR=Navy]Sub[/COLOR]
Regards Mick


Hi Mick, your codes work. However, when i save the file and transfer it into a thumbdrive, the codes completely don't work anymore. As in no images will be displayed.

Do you know how to display images from worksheet A to worksheet B with a click of a button? thanks you :)
 
Upvote 0
I don't see any reason for it not working after storage on a Flash Drive, :- The files the File!!!!
If you record a macro to copy & paste a picture to another sheet that will give you the code.
If you want to hide and unhide the picture on another sheet before opening ??
Modification to the original code should do:-
Code:
With Sheets("sheet2").Shapes("Picture 3")
    .Visible = Not .Visible
End With
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,391
Members
452,909
Latest member
VickiS

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