Hide Selected Objects

C

Clara

Hi,

Anyone know how can i hide selected objects only instead of hiding all
objects in my worksheet?
 
G

Gord Dibben

With VBA you could probably do this.

What type of objects are you referring to?

Selectable objects you have inserted like drawing objects or pictures?


Gord Dibben MS Excel MVP
 
S

Shane Devenshire

Hi,

Following up on Gord's suggestion here is code that will hide the selected
objects, in this case shapes:

Selection.ShapeRange.Visible = False

Keep in mind that you can't reverse this by writing

Selection.ShapeRange.Visible = True

besause you can't select things you can't see. So in that case you need
something like this

ActiveSheet.Shapes.Range(Array("Rectangle 1", "Rectangle 2")).Visible = True
 
J

Jacob Skaria

Hi Clara

Try the below macro. You dont need to select the object; instead just select
the cell range. All objects within selection will be hidden

Sub Macro1()
Dim obj As Object
For Each obj In ActiveSheet.DrawingObjects
If Not Intersect(obj.TopLeftCell, Selection) Is Nothing Then
obj.Visible = False
End If
Next
End Sub

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top