cmefly
Well-known Member
- Joined
- May 13, 2003
- Messages
- 683
hi,
i've got a simple macro that is hiding rows based on a condition....but it takes almost an entire minute to run......any ideas on how to speed this up?
Private Sub Worksheet_Activate()
Dim x As Variant
Dim y As String
Dim i As Integer
Dim j As Integer
Dim b As String
Dim col As Integer
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
col = 1
Rows("23:2806").Select
Selection.EntireRow.Hidden = False
Range("A24").Select
For i = 24 To 1200
y = Range("a" & i).Value
x = Application.VLookup(y, Sheets("hidden1").Range("a1:b22"), col, 0)
If IsError(x) Then
Rows(i).EntireRow.Hidden = True
End If
b = Range("O" & i).Value
If IsEmpty("O" & i) Then
Rows(i).EntireRow.Hidden = False
End If
If b = "Hide" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
end sub
thank you in advance.
cmefly
i've got a simple macro that is hiding rows based on a condition....but it takes almost an entire minute to run......any ideas on how to speed this up?
Private Sub Worksheet_Activate()
Dim x As Variant
Dim y As String
Dim i As Integer
Dim j As Integer
Dim b As String
Dim col As Integer
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
col = 1
Rows("23:2806").Select
Selection.EntireRow.Hidden = False
Range("A24").Select
For i = 24 To 1200
y = Range("a" & i).Value
x = Application.VLookup(y, Sheets("hidden1").Range("a1:b22"), col, 0)
If IsError(x) Then
Rows(i).EntireRow.Hidden = True
End If
b = Range("O" & i).Value
If IsEmpty("O" & i) Then
Rows(i).EntireRow.Hidden = False
End If
If b = "Hide" Then
Rows(i).EntireRow.Hidden = True
End If
Next i
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
end sub
thank you in advance.
cmefly