I wrote this code to hide unused rows on a worksheet but it doesn't seem to do anything.
I previously had a loop but it was taking too long because the list was too long.
what did I do wrong?
any help would be much appreciated.
Dim ColChk As String
Dim HideValue As String
ColChk = "I7:I"
HideValue = ""
Dim Rng As Range
With ActiveSheet
.AutoFilterMode = False
.Range(ColChk & .Rows.Count).AutoFilter Field:=1, Criteria1:=HideValue
With .AutoFilter.Range
On Error Resume Next
Set Rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not Rng Is Nothing Then Rng.EntireRow.Hidden = True
End With
End With
If ActiveSheet.AutoFilterMode = True Then
ActiveSheet.Cells.AutoFilter
End If
Bookmarks