Hide/Unhide an Autoshape or Picture in Excel
Solved/Closed
Related:
- Excel vba hide picture
- Vba hide picture - Best answers
- Excel hide picture - Best answers
- Excel vba insert picture from folder - Forum - Excel
- Excel vba hide formula bar - Guide
- Excel vba insert picture from folder based on cell value ✓ - Forum - Excel
- Adding a loop to macro to insert pictures ✓ - Forum - Excel
- Excel Picture Inserting Macro Help - Urgent ✓ - Forum - Excel
4 replies
rizvisa1
May 10, 2010 at 08:16 AM
- Posts
- 4479
- Registration date
- Thursday January 28, 2010
- Status
- Contributor
- Last seen
- May 5, 2022
May 10, 2010 at 08:16 AM
Use the properties
.visible = true and .visible = false
ActiveSheet.Pictures("Picture 2").Visible = True
.visible = true and .visible = false
ActiveSheet.Pictures("Picture 2").Visible = True
Thank you, this requires to execute the Code to do the job. What I need is when the file is opened the Sheet should not show some of the Autoshapes or Pictures in the sheet and keeps some other hidden.
When I run my other Marcos these Autoshapes or Pictures will be Unhide or deleted.
In this scenario if I used the Code to hide Autoshapes or Pictures in the WorksheetOpen event and executed all my other macros in the files and saved the resulting file as a "New File" and when I go back to open the "New File" some errors will be shown due to the WorksheetOpen event Code.
I hope you may understood (blame my poor language) my problem.
Thanks and Regards,
PramodKumar
When I run my other Marcos these Autoshapes or Pictures will be Unhide or deleted.
In this scenario if I used the Code to hide Autoshapes or Pictures in the WorksheetOpen event and executed all my other macros in the files and saved the resulting file as a "New File" and when I go back to open the "New File" some errors will be shown due to the WorksheetOpen event Code.
I hope you may understood (blame my poor language) my problem.
Thanks and Regards,
PramodKumar
rizvisa1
May 11, 2010 at 06:08 AM
- Posts
- 4479
- Registration date
- Thursday January 28, 2010
- Status
- Contributor
- Last seen
- May 5, 2022
May 11, 2010 at 06:08 AM
Why not enclose the part of making it visible, hidden or delete sandwiched bewteeen
On Error Resume Next
On Error goto 0
On Error Resume Next
On Error goto 0
Once again you did it for me! Wonderful tip, Thanks a lot.
Now my Code looks as below:
Private Sub Workbook_Open()
On Error Resume Next
ActiveSheet.Shapes("Button08").Visible = False
ActiveSheet.Shapes("Button09").Visible = False
ActiveSheet.Shapes("Button10").Visible = False
ActiveSheet.Shapes("Button 55").Visible = False
ActiveSheet.Shapes("Button 56").Visible = False
ActiveSheet.Shapes("Button 57").Visible = False
ActiveSheet.Shapes("Button 64").Visible = False
ActiveSheet.Shapes("Button 65").Visible = False
ActiveSheet.Shapes("Button 66").Visible = False
ActiveSheet.Shapes("Button 67").Visible = False
ActiveSheet.Shapes("Button 74").Visible = False
On Error GoTo 0
End Sub
With Regards,
PramodKumar
Now my Code looks as below:
Private Sub Workbook_Open()
On Error Resume Next
ActiveSheet.Shapes("Button08").Visible = False
ActiveSheet.Shapes("Button09").Visible = False
ActiveSheet.Shapes("Button10").Visible = False
ActiveSheet.Shapes("Button 55").Visible = False
ActiveSheet.Shapes("Button 56").Visible = False
ActiveSheet.Shapes("Button 57").Visible = False
ActiveSheet.Shapes("Button 64").Visible = False
ActiveSheet.Shapes("Button 65").Visible = False
ActiveSheet.Shapes("Button 66").Visible = False
ActiveSheet.Shapes("Button 67").Visible = False
ActiveSheet.Shapes("Button 74").Visible = False
On Error GoTo 0
End Sub
With Regards,
PramodKumar
rizvisa1
May 11, 2010 at 07:57 AM
- Posts
- 4479
- Registration date
- Thursday January 28, 2010
- Status
- Contributor
- Last seen
- May 5, 2022
May 11, 2010 at 07:57 AM
Superb. And thanks for posting your solution. It just might help some one else too.