Hi Everyone,
I have an annoying problem. At my work, we use an Excel template that uses various rows with fields that can be unhidden if the user needs. The VBA code uses a loop and the Worksheet_Change functionality (it's slow, and not my code - I need to redo it). Nevertheless, the code runs fine for me and various other coworkes. However, one coworker experiences 10-20 seconds of annoying delay after every entry in the template. It seems the code takes way too long to run through its loop. Any ideas? I've checked that we are using the same code and the same version of Excel.
If needed, here is the code. Column A's cells all have an If formula that defaults to value 0, but changes to 1 if the user changes certain other fields to add the rows Example formula =IF(D50="Y", 1, 0)
Private Sub Worksheet_Change(ByVal Target As Range)
Dim xRg As Range
Application.ScreenUpdating = False
ActiveSheet.DisplayPageBreaks = False
Application.Calculation = xlCalculationManual
For Each xRg In Range("A1:A461")
If xRg.Value = "0" Then
xRg.EntireRow.Hidden = True
Else
xRg.EntireRow.Hidden = False
End If
Next xRg
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Thank you so much for any ideas!