Good afternoon,
I have the following code:
At present if I double-click on cell A1, rows 2 through 5 UNHIDE. If I right-click on cell A1, rows 2 through 5 HIDE.
Obviously right-clicking on a cell is not the best option.
I want to change this code so that If I click on cell A1, rows 2 through 5 UNHIDE, and If I click AGAIN on cell A1, rows 2 through 5 HIDE.
Any comments greatly received.
Best Regards
manc
I have the following code:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Target.Address = "a1" Then
Rows("2:5").Hidden = False
Else
Exit Sub
End If
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
If Target.Address <> "$a$1" Then
Rows("2:5").Hidden = True
Else
Exit Sub
End If
End Sub
At present if I double-click on cell A1, rows 2 through 5 UNHIDE. If I right-click on cell A1, rows 2 through 5 HIDE.
Obviously right-clicking on a cell is not the best option.
I want to change this code so that If I click on cell A1, rows 2 through 5 UNHIDE, and If I click AGAIN on cell A1, rows 2 through 5 HIDE.
Any comments greatly received.
Best Regards
manc