I tried, I
really tried to walk away. But Keith has pushed one of my
MrExcel OCD buttons.
There is always a chance that you will some day take code from an existing routine and copy and paste it into another project where the original routine gets called by a "Main" routine, i.e. the original procedure is now a part of a larger sequence of procedures. You don't want to
assume that you are restoring the settings to their original values when the routine was called, you want to
know that you're restoring them. In other words.
should read
Code:
Dim i As Long, rowx As Long, LR As Long, LC As Long, _
booScrnUpdt As Boolean, lngCalcMode As XlCalculation
With Application
Let booScrnUpdt = .ScreenUpdating
Let lngCalcMode = .Calculation
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
'// {snip}
With Application
.ScreenUpdating = booScrnUpdt
.Calculation = lngCalcMode
End With