Hi,
I'm hoping someone can help me with the code to combine the two macros below. They are identical except for the color boxes they are looking for. I'm looking for one macro to clear both the red and green boxes.
Thanks in advance or anyone that has a look!
-------------------------------------------------------------------------
Sub DeleteRedBox()
Dim shp As Shape
'Loop through each shape on active sheet
For Each shp In ActiveSheet.Shapes
'Find shapes with a name starting with "RedBox_"
If Left(shp.Name, 7) = "RedBox_" Then
'Delete the shape
shp.Delete
End If
Next shp
End Sub
-----------------------------------------------------------
Sub DeleteGreenBox()
Dim shp As Shape
'Loop through each shape on active sheet
For Each shp In ActiveSheet.Shapes
'Find shapes with a name starting with "GreenBox_"
If Left(shp.Name, 9) = "GreenBox_" Then
'Delete the shape
shp.Delete
End If
Next shp
End Sub
I'm hoping someone can help me with the code to combine the two macros below. They are identical except for the color boxes they are looking for. I'm looking for one macro to clear both the red and green boxes.
Thanks in advance or anyone that has a look!
-------------------------------------------------------------------------
Sub DeleteRedBox()
Dim shp As Shape
'Loop through each shape on active sheet
For Each shp In ActiveSheet.Shapes
'Find shapes with a name starting with "RedBox_"
If Left(shp.Name, 7) = "RedBox_" Then
'Delete the shape
shp.Delete
End If
Next shp
End Sub
-----------------------------------------------------------
Sub DeleteGreenBox()
Dim shp As Shape
'Loop through each shape on active sheet
For Each shp In ActiveSheet.Shapes
'Find shapes with a name starting with "GreenBox_"
If Left(shp.Name, 9) = "GreenBox_" Then
'Delete the shape
shp.Delete
End If
Next shp
End Sub