I'm having this problem for the last few hours and I would really appreciate some help with it.
Basically, I want to be able to hide/unhide shapes depending on selections a user makes on a userform. I've broken the problem down into a very simple example. If I insert a shape called "oval 1" in a sheet and run the code:
Sub hideshape()
With ActiveSheet
.Shapes("Oval 1").Select
With Selection
.Visible = False
End With
End With
End Sub
the shape disappears but when I run this code
Sub unhideshape()
With ActiveSheet
.Shapes("Oval 1").Select
With Selection
.Visible = True
End With
End With
End Sub
I get an error "Requested Shapes are locked for Selection"
The workbook is not protected and I have tried un-ticking locked and locked text on the shape properties.
Any ideas what's causing this.
Select the shape or shapes that you want to make transparent. On the Shape tab, select Shape Fill > Transparency, then select the percentage you want.
Add a shape in Excel, Outlook, Word, or PowerPointOn the Insert tab, click Shapes. Click the shape you want, click anywhere in the workspace, and then drag to place the shape.
Hide UnHide Columns in Excel Worksheet using VBA – Solution We can use EntireColumn. Hidden property of a Column. You can set the property value to TRUE if you want to hide, Set to FALSE if you want to un-hide the Columns.
You cannot Select
a hidden object. However, you dont need to use Select
at all, and it is usually not recommended. Try simply:
Sub HideShape()
ActiveSheet.Shapes("Oval 1").Visible = False
End Sub
Sub UnhideShape()
ActiveSheet.Shapes("Oval 1").Visible = True
End Sub
Sub HideEachShape()
Dim sObject As Shape
For Each sObject In ActiveSheet.Shapes
sObject.Visible = False
Next
End Sub
from: extendoffice.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With