One of the reasons I said you might curse is because it seems slow. To
tell you the truth I have little experience with this event's
procedures. A filtering causes recalculation and for some time I was in
infinite loops, while developing. The line:
r = Sheets("Sheet3").UsedRange.Rows.Count
is there exactly in order to speed up the calculation.
UsedRange.Rows.Count will return 204 if this is the highest row number
in which you have made changes. I did not have time to check what
exactly is going on, but it was slow on me as well. Try the following
version, in which I am temporarily suspending automatic calculation
while the loop is taking place.
Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
Dim col As Range
r = Sheets("Sheet3").UsedRange.Rows.Count
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
For i = 1 To r
If Sheets("Sheet3").Range("B" & i).Value = "" Then
Sheets("Sheet3").Range("B" & i).EntireRow.Hidden = True
Else
Sheets("Sheet3").Range("B" & i).EntireRow.Hidden = False
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
End Sub
Let me know how this works. If I have time I will study the code in
more detail.
Note: If anything goes wrong and you have to terminate the macro before
it is over, calculation will likely remain manual. This will affect the
entire application, i.e. any workbook you open. To return to automatic
calculation more, Tools|Options|Calculation tab.
HTH
Kostis Vezerides