Marc L
Excel Ninja
Can you point me the error in the code in post #19 ?
Your Txt variable is not a valid range address because you forgot
(you must mod formula using ADDRESS, it's just Excel basics formula !)
Can you point me the error in the code in post #19 ?
(you must mod formula using ADDRESS, it's just Excel basics formula !)
Private Sub CommandButton1_Click()
Dim VA, X, AD$
Dim Txt As String
CommandButton1.Caption = IIf(CommandButton1.Caption = "Hide", "Show", "Hide")
Application.ScreenUpdating = False
AD = Sheets("Sheet1").Range("G3", Range("G" & Rows.Count).End(xlUp)).Address
'TRANSPOSE(IF(G3:G55=0,ADDRESS(ROW(G3:G55),7,4)))
VA = Filter(Sheet1.Evaluate("TRANSPOSE(IF(" & AD & "=0,ADDRESS(ROW(" & AD & "),7,4)))"), False, False)
Txt = Join(VA, ",")
Do While Len(Txt) > 250
X = InStrRev(Txt, ",", 255)
Range(Left$(Txt, X - 1)).EntireRow.Hidden = True
Txt = Mid$(Txt, X + 1)
Loop
If Len(Txt) Then Range(Txt).EntireRow.Hidden = False
Application.ScreenUpdating = True
End Sub
Private Sub CommandButton1_Click()
Dim R As Long
CommandButton1.Caption = IIf(CommandButton1.Caption = "Hide", "Show", "Hide")
Application.ScreenUpdating = False
For R = 4 To Cells(Rows.Count, 7).End(xlUp).Row
Rows(R).Hidden = (Cells(R, 7).Value = 0) * (CommandButton1.Caption = "Show")
Next
Application.ScreenUpdating = True
End Sub
Dim VA
If CommandButton1.Caption = "Show" Then
Me.UsedRange.Rows.Hidden = False: CommandButton1.Caption = "Hide"
Else
VA = Filter(Evaluate(Replace("TRANSPOSE(IF(#=0,ADDRESS(ROW(#),7,4)))", "#", [A3].CurrentRegion.Columns(7).Address)), False, False)
If UBound(VA) > -1 Then Range(Join(VA, ",")).EntireRow.Hidden = True: CommandButton1.Caption = "Show"
End If
Dim B%, V
If CommandButton1.Caption = "Show" Then
Me.UsedRange.Rows.Hidden = False: CommandButton1.Caption = "Hide"
Else
Application.ScreenUpdating = False
For Each V In Filter(Evaluate(Replace("TRANSPOSE(IF(#=0,ROW(#)))", "#", [A3].CurrentRegion.Columns(7).Address)), False, False)
Rows(V).Hidden = True: B = 1
Next
If B Then CommandButton1.Caption = "Show"
Application.ScreenUpdating = True
End If
Private Sub CommandButton1_Click()
If Me.FilterMode Then Cells(1).AutoFilter
If CommandButton1.Caption = "Hide" Then Range("G3", Cells(Rows.Count, 7).End(xlUp)(0)).AutoFilter 1, ">0", , , 0
CommandButton1.Caption = IIf(Me.FilterMode, "Show", "Hide")
End Sub