I have created a macro that cycles through a list of input variables from 2 separate tables. It copies input variables into 2 specific cells (C19 & C22). This action calculates a new value in cell C14 and that value is then copied and pasted into a table (E58:O69). Then it loops to the next 2 input variables and continues until it has cycled through and populated the entire table.
The process is extremely simple and it works but it is time consuming. I have several similar macros with the same file and it takes 30 minutes to cycle through all of the calculations. If it is possible to make improvements in the speed it would be extremely helpful.
I tried to search through the questions and content to see if I could find a similar issue. There may be examples in on the board but unfortunately I could not find one that helped me, if any suggestion could be made it would be much appreciated.
The process is extremely simple and it works but it is time consuming. I have several similar macros with the same file and it takes 30 minutes to cycle through all of the calculations. If it is possible to make improvements in the speed it would be extremely helpful.
I tried to search through the questions and content to see if I could find a similar issue. There may be examples in on the board but unfortunately I could not find one that helped me, if any suggestion could be made it would be much appreciated.
VBA Code:
Sub Run_price_capex_sensitivities()
Application.ScreenUpdating = False
'Definie percentages for sensitivities
Set sensPriceRange = Range("D30:D40")
Set sensCapexRange = Range("E22:O22")
'Defintion data paste ranges
Set sensNPVCapexPasteRange = Range("E58:O58")
'Definition cells linked to QVM quick sensitivities
Set Primarysenscell = Range("C19")
Set SecondsensCapexcell = Range("C22")
'define number of rows for price
For n = 1 To 11
'copies primary sensitivity range
sensPriceRange(n, 1).Cells.Copy
'pastes primary sensitivity value to be used in calculation
Primarysenscell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'define number of columns for primary sensitivity
For i = 1 To 11
'copies capex sensitivity of x%
sensCapexRange.Cells(1, i).Copy
'pastes capex sensitivity
SecondsensCapexcell.Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'gets NPV from cell C14
Range("C14").Cells.Copy
'Pastes NPV values for Capex sensitivity in row n and columns i
sensNPVCapexPasteRange.Cells(n, i).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Next i
Next n
Application.ScreenUpdating = True
End Sub