Ancient Wolf
Board Regular
- Joined
- Mar 17, 2009
- Messages
- 89
Can you help me on this one?
I created an Excel sheet that has several macro controlled buttons that were created using the insert shapes tool. Each button will hide/unhide specific rows when clicked. I have another macro controlled button that, in short, resets the page and re-hides any rows that were unhidden. I was given the coding below as a way to identify which buttons the user clicked on. The problem is that if you use the "Reset" button to re-hide rows, then the clicked buttons do not revert. Is there a way to make my "Reset" button undo the color changes? There are 11 buttons that would need to be "unclicked", and are all the same square shape if that helps.
Dim oShape As Shape
Set oShape = ActiveSheet.Shapes(Application.Caller)
If oShape.Fill.ForeColor.RGB = RGB(255, 0, 0) Then
oShape.Fill.ForeColor.RGB = RGB(0, 0, 255)
oShape.TextFrame.Characters.Text = "Unclicked"
With Rows("84:95")
.Hidden = Not .Hidden
End With
Else
oShape.Fill.ForeColor.RGB = RGB(255, 0, 0)
oShape.TextFrame.Characters.Text = "Clicked"
With Rows("84:95")
.Hidden = Not .Hidden
End With
End If
I created an Excel sheet that has several macro controlled buttons that were created using the insert shapes tool. Each button will hide/unhide specific rows when clicked. I have another macro controlled button that, in short, resets the page and re-hides any rows that were unhidden. I was given the coding below as a way to identify which buttons the user clicked on. The problem is that if you use the "Reset" button to re-hide rows, then the clicked buttons do not revert. Is there a way to make my "Reset" button undo the color changes? There are 11 buttons that would need to be "unclicked", and are all the same square shape if that helps.
Dim oShape As Shape
Set oShape = ActiveSheet.Shapes(Application.Caller)
If oShape.Fill.ForeColor.RGB = RGB(255, 0, 0) Then
oShape.Fill.ForeColor.RGB = RGB(0, 0, 255)
oShape.TextFrame.Characters.Text = "Unclicked"
With Rows("84:95")
.Hidden = Not .Hidden
End With
Else
oShape.Fill.ForeColor.RGB = RGB(255, 0, 0)
oShape.TextFrame.Characters.Text = "Clicked"
With Rows("84:95")
.Hidden = Not .Hidden
End With
End If