We have an EXCEL-based app (VBA) that allows a user to open an empty workbook, then pull data from different data sources. For each data object read, a new sheet is automatically created and the data loaded into it. Generally, for this type of exercise the user ends up with a few hundred sheets. However, for some applications tens of thousands are required (it is a product configuration environment).
Our problem is the speed at which new (completely blank) sheets are created. From the behaviour we observe, it is clear that sheet creation slows down as number of sheets grows.
We use 64-Bit Excel, on core i5 processors, with 20GB RAM. To test performance, we use the following VBA macro (which only generates blank sheets). It takes us over 2mins to run this the first time, then around 6mins to run it a second time. We suspect - from this behaviour - that the slowdown is software-related (possibly the 'sheet list' maintained internally is not indexed, bcos it is not expected that this many sheets will be required).
At this point, we are looking at a hardware upgrade to get better performance. Any advice will be appreciated.
Dim StartTime As Double, I As Long, J As Long
Sub NewSheets()
' Turn off UI responses
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
ActiveWindow.DisplayWorkbookTabs = False
' Add new sheets
I = Sheets.Count
J = I + 25000
StartTime = Timer
While I < J
Sheets.Add After:=Sheets(I)
I = I + 1
Wend
' Restore Excel settings to original state.
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
ActiveWindow.DisplayWorkbookTabs = True
' Msg to indicate duration
MsgBox ("Elapsed Time: " & Format(Timer - StartTime, "###0.00") & " secs")
Sheets(1).Activate
End Sub
Our problem is the speed at which new (completely blank) sheets are created. From the behaviour we observe, it is clear that sheet creation slows down as number of sheets grows.
We use 64-Bit Excel, on core i5 processors, with 20GB RAM. To test performance, we use the following VBA macro (which only generates blank sheets). It takes us over 2mins to run this the first time, then around 6mins to run it a second time. We suspect - from this behaviour - that the slowdown is software-related (possibly the 'sheet list' maintained internally is not indexed, bcos it is not expected that this many sheets will be required).
At this point, we are looking at a hardware upgrade to get better performance. Any advice will be appreciated.
Dim StartTime As Double, I As Long, J As Long
Sub NewSheets()
' Turn off UI responses
Application.ScreenUpdating = False
Application.DisplayStatusBar = False
Application.Calculation = xlCalculationManual
Application.EnableEvents = False
ActiveWindow.DisplayWorkbookTabs = False
' Add new sheets
I = Sheets.Count
J = I + 25000
StartTime = Timer
While I < J
Sheets.Add After:=Sheets(I)
I = I + 1
Wend
' Restore Excel settings to original state.
Application.ScreenUpdating = True
Application.DisplayStatusBar = True
Application.Calculation = xlCalculationAutomatic
Application.EnableEvents = True
ActiveWindow.DisplayWorkbookTabs = True
' Msg to indicate duration
MsgBox ("Elapsed Time: " & Format(Timer - StartTime, "###0.00") & " secs")
Sheets(1).Activate
End Sub
Comment