This worked:
Code:
Sub HideRows()
Application.ScreenUpdating = False
Dim i As Integer
Range(Range("B2"), Sheets("Sheet1").Range("B1048576").End(xlUp).Offset(0, 3)).Select
On Error Resume Next
With Selection
.EntireRow.Hidden = False
For i = 2 To .Rows.Count
If IsEmpty(Range("B" & i)) Then
.Rows(i - 1).EntireRow.Hidden = True
End If
Next i
End With
Range("A1").Select
Application.ScreenUpdating = True
End Sub
Is there a column that will have a value in every row? If so, use this column in place of B in the line setting Range. If not, will need different criteria to determine bottom of range or else run code through the whole 1048576 rows. How many columns have data?
I also got filter to work:
Sub FilterRows()
Range("B1:B1048576").Select
Selection.AutoFilter
ActiveSheet.Range("B1:B1048576").AutoFilter Field:=1, Criteria1:="<>"
End Sub