Please read the following template:
PID Status LPID
10 Closed 25
11 Open 25
31 Open 31
25 Closed 25
54
Some suggested improvements:
In case you really have the screen open the excel: set Application.ScreenUpdating = False
at start of your code (and True
and the end)
Set the Application.Calculation to manual. At start of your code:
Application.Calculation = xlCalculationManual
and at the end back to automatic: Application.Calculation = xlCalculationAutomatic
. In case this was not automatic per se, you could also first store the original setting into a local variable and restore that value at the end.
Use VBA to see if performance is better there (if VBA would be a valid option for you)
Use Value2
in stead of Value
, this property is faster to consult.
Reduce the number of Loops especially when you are looking for specific values in a range. You could alternatively use Excel Lookup & Reference functions (such as VLookup), those might run more efficient and faster.