I have a group of shapes which I hide and unhide using vb code. However, the code does not work when new shapes are added to the group because the name of the new grouped shapes changes but my codes specifically refers only to the name of the previous grouped shapes. Is there a general code that will address this issue? Thank you for your help. Please see attached file.
Here's my code:
Here's my code:
Code:
Sub RoundedRectangle4_Click()
With ActiveSheet.Shapes("Rounded Rectangle 4").TextFrame2.TextRange.Characters
If .Text = "Hide Floor Plan" Then
.Text = "Show Floor Plan"
ActiveSheet.Shapes("group 5").Visible = False
Else
.Text = "Hide Floor Plan"
With ActiveSheet.Shapes("Rounded Rectangle 4")
ActiveSheet.Shapes("group 5").Left = .Left + .Width
ActiveSheet.Shapes("group 5").Top = .Top + .Height
ActiveSheet.Shapes("group 5").Visible = True
End With
End If
End With
End Sub
Attachments
Last edited by a moderator: