I am working with a fairly large dataset for which I am trying to develop the quickest code possible that will:
1. Find the rows (from 10 to 16009) in the fourth column whose value =0
2. Hide the entire row where this condition is true
Here is the code I am working with, however it obviously very slow. I would appreciate any advice as to how to improve this or utilize a better method.
Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Dim i As Integer
Dim r As Integer
Dim x As Variant
Dim y As Variant
x = Array(10)
y = Array(16009)
For i = 0 To 2
For r = x(i) To y(i)
If Cells(r, 4).Value = "0" Then
Rows(r).EntireRow.Hidden = True
Else
Rows(r).EntireRow.Hidden = False
End If
Next r
Next i
Application.ScreenUpdating = True
Application.Calculate
End Sub
Bookmarks