TheArtMan
03-01-2021, 04:00 PM
I have a spreadsheet with ActiveX option buttons in groups. They are ActiveX buttons, not Form Controls buttons. Those buttons are in rows 7:30. I have a command button (also ActiveX) with the caption "Hide" that will hide rows 7:30 and then change the caption to "Show." When I click on that command button again, it unhides rows 7:30 and changes the caption to "Hide." After hiding/unhiding those rows, the option buttons no longer work. When I click on one, a "ghost" option button appears below the selected option button on mouse-down, and then the ghost option button disappears on mouse-up.
Command button code (pretty basic):
Option Explicit
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Hide" Then
Rows("2:6").EntireRow.Hidden = True
CommandButton1.Caption = "Show"
Else
Rows("2:6").EntireRow.Hidden = False
CommandButton1.Caption = "Hide"
End If
End Sub
In order to get the option buttons to work again, I must close and reopen the workbook.
I created a second test spreadsheet (attached) to see if this behavior was unique, and the second test spreadsheet displays the same behavior.
If anyone knows what may be causing this and, more importantly, how to keep it from happening, that would be wonderful!
Command button code (pretty basic):
Option Explicit
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Hide" Then
Rows("2:6").EntireRow.Hidden = True
CommandButton1.Caption = "Show"
Else
Rows("2:6").EntireRow.Hidden = False
CommandButton1.Caption = "Hide"
End If
End Sub
In order to get the option buttons to work again, I must close and reopen the workbook.
I created a second test spreadsheet (attached) to see if this behavior was unique, and the second test spreadsheet displays the same behavior.
If anyone knows what may be causing this and, more importantly, how to keep it from happening, that would be wonderful!