rakupareek
New Member
- Joined
- Dec 29, 2023
- Messages
- 38
- Office Version
- 2016
- Platform
- Windows
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim ToggleCell As Range
Dim HiddenRows As Range
Set ToggleCell = Range("B5")
If Not Intersect(Target, ToggleCell) Is Nothing Then
Set HiddenRows = Range("6:13")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Row = 14 And Target.Column = 2 Then
Set HiddenRows = Range("15:16,23:24")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Row = 15 And Target.Column = 2 Then
Set HiddenRows = Range("16:22")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Row = 23 And Target.Column = 2 Then
Set HiddenRows = Range("24:30")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Address = "$C$15" Then
Worksheets("Anx-1").Activate
Cancel = True
ElseIf Target.Address = "$C$23" Then
Worksheets("Anx-2").Activate
Cancel = True
End If
End Sub
Hi
I am Using above code to hide and unhide rows but I want to know that
WHEN I DOUBLE CLICK ON ROW 15 THEN HIDE ROW 16:22 AND WHEN I RECLICK ON ROW 15 THEN UNHIDE ONLY NEXT ROW TO LAST FILL ROW (FROM SET RANGE 16:22)
AS IT IS WHEN I DOUBLE CLICK ON ROW 23 THEN HIDE ROW 24:30 AND WHEN I RECLICK ON ROW 23 THEN UNHIDE ONLY NEXT ROW TO LAST FILL ROW(FROM SET RANGE 24:30)
Is it possible????
Dim ToggleCell As Range
Dim HiddenRows As Range
Set ToggleCell = Range("B5")
If Not Intersect(Target, ToggleCell) Is Nothing Then
Set HiddenRows = Range("6:13")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Row = 14 And Target.Column = 2 Then
Set HiddenRows = Range("15:16,23:24")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Row = 15 And Target.Column = 2 Then
Set HiddenRows = Range("16:22")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Row = 23 And Target.Column = 2 Then
Set HiddenRows = Range("24:30")
HiddenRows.EntireRow.Hidden = Not HiddenRows.EntireRow.Hidden
Cancel = True
ElseIf Target.Address = "$C$15" Then
Worksheets("Anx-1").Activate
Cancel = True
ElseIf Target.Address = "$C$23" Then
Worksheets("Anx-2").Activate
Cancel = True
End If
End Sub
Hi
I am Using above code to hide and unhide rows but I want to know that
WHEN I DOUBLE CLICK ON ROW 15 THEN HIDE ROW 16:22 AND WHEN I RECLICK ON ROW 15 THEN UNHIDE ONLY NEXT ROW TO LAST FILL ROW (FROM SET RANGE 16:22)
AS IT IS WHEN I DOUBLE CLICK ON ROW 23 THEN HIDE ROW 24:30 AND WHEN I RECLICK ON ROW 23 THEN UNHIDE ONLY NEXT ROW TO LAST FILL ROW(FROM SET RANGE 24:30)
Is it possible????