Hi
I have a macro that I use on a calculation model that, for each member in my data output, calculates some outputs and pastes the results as values, then moves on to the next member and does the same. The member chosen cycles from 1 to i. The output sheet has a bunch of formulas in row 7 (cells A7, B7, C7 etc. up to AQ7 currently) that refer to named ranges on the model that calculate the results for each member - this way, when I need to add outputs, let's say a new named range called NewOutput, I can just put =NewOutput in cell AR7.
The macro works, but is very slow (15 minutes on my laptop, ~60 minutes on her older model). My senior has asked me to change the macro to not use the InsertRow function, as she thinks it is what's making it slow. I lifted the macro from another workbook, so wondered whether you geniuses could help. The macro is here:
Sub Bulk_run()
'
' Bulk_run Macro
'
'
Application.ScreenUpdating = False
Sheets("Output").Select
Rows("10:64000").Select
Selection.Delete
For i = 1 To 2636
Sheets("Model").Select
Range("IndexNumber").Select
ActiveCell.FormulaR1C1 = i
Sheets("Output").Select
Rows("7:7").Select
Selection.Copy
Rows("10:10").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("10:10").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Next i
Application.ScreenUpdating = True
End Sub
I have a macro that I use on a calculation model that, for each member in my data output, calculates some outputs and pastes the results as values, then moves on to the next member and does the same. The member chosen cycles from 1 to i. The output sheet has a bunch of formulas in row 7 (cells A7, B7, C7 etc. up to AQ7 currently) that refer to named ranges on the model that calculate the results for each member - this way, when I need to add outputs, let's say a new named range called NewOutput, I can just put =NewOutput in cell AR7.
The macro works, but is very slow (15 minutes on my laptop, ~60 minutes on her older model). My senior has asked me to change the macro to not use the InsertRow function, as she thinks it is what's making it slow. I lifted the macro from another workbook, so wondered whether you geniuses could help. The macro is here:
Sub Bulk_run()
'
' Bulk_run Macro
'
'
Application.ScreenUpdating = False
Sheets("Output").Select
Rows("10:64000").Select
Selection.Delete
For i = 1 To 2636
Sheets("Model").Select
Range("IndexNumber").Select
ActiveCell.FormulaR1C1 = i
Sheets("Output").Select
Rows("7:7").Select
Selection.Copy
Rows("10:10").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("10:10").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Next i
Application.ScreenUpdating = True
End Sub