I am trying to create a macro that will auto filter but nicer. Based on a specific cell drop down list (cell H4). But there are headings that I do not want hidden no matter the value i nthe drop down list. My code is below:
Sub HideRows()
Dim LastRow As Long, i As Long

LastRow = Cells(65356, 2).End(xlUp).Row
Application.ScreenUpdating = False
For i = LastRow To 2 Step -1
If Cells(i, 2).Value = "" Then
Cells(i, 2).EntireRow.Hidden = True
End If
If Cells(i, 4).Value = Cell.Value(4, 8) Then
Cells(i, 4).EntireRow.Hidden = False
End If
Next i

Application.ScreenUpdating = True



End Sub
I am getting an object error. My logic is that first the macro will hide all non-heading lines, as they don't have anything in column B, then unhide all the rows where the column D valuse match cell H4. Can this work this way? I can post the excel if necessary. Thanks