Hide All Shape Based On Background Color

a_t_a

New Member
Joined
Nov 22, 2017
Messages
10
Hi
I want hidde all oval shape with filled color is RED
my Shape name is oval 1 , oval 2, oval 3 , and ……..oval n


With this macro hide all shape


HTML:
Dim i As Long
      For i = 1 To ActiveSheet.Shapes.Count
      ActiveSheet.Shapes.Range(Array("Oval " & i)).Visible = Not ActiveSheet.Shapes.Range(Array("Oval " & i)).Visible
      Next i



I want hide only red shape with macro
Download File :
http://www.sharefile.ir/uploads/1511404325.xlsx
Or
http://ge.tt/7MvyWRn2


tnx
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Code:
Public Sub HideRedOvals()

ShowHideShapes "Oval ", RGB(255, 0, 0), msoFalse

End Sub
Private Sub ShowHideShapes(shapeName As String, foreColor As Long, showHide As MsoTriState)

Dim thisShape As Shape

For Each thisShape In ActiveSheet.Shapes
    If StrComp(Left$(thisShape.Name, Len(shapeName)), shapeName, vbTextCompare) = 0 _
    And thisShape.Fill.foreColor = foreColor Then
        thisShape.Visible = showHide
    End If
Next

End Sub

WBD
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,212
Members
453,023
Latest member
alabaz

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