How to show and hide objects in VBA

Insert this code inside a Module in the VBA:

If Worksheets(“SHEET1”).Range(“A1”).Value <= Worksheets(“SHEET1”).Range(“B1”).Value Then
Worksheets(“SHEET1”).Shapes(“Group 01”).Visible = False
Worksheets(“SHEET1”).Shapes(“Group 02”).Visible = True
Worksheets(“SHEET1”).Shapes(“Group 01”).Visible = True
Worksheets(“SHEET1”).Shapes(“Group 02”).Visible = False
End If

Change SHEET1: as per the worksheet
Change Range: as per the cell of your condition
Change shape: as per the object name, you can find it when you click on a group and see at the left of the function bar.

Leave a Reply