Hi, I tried several solutions but can't find a solution for the error. I'm trying to do a lot of calculations and put them all in a 2-dimensional table. Hopefully someone can help me with the error and perhaps amend the code to speed up the calculations. Thanks for any help!
VBA Code:
Sub UpdateSensitivitiesTables()
Application.ScreenUpdating = False
Dim Result() As Variant
EndRow = Range("EndRow").Value
EndColumn = Range("EndColumn").Value
StartRow = Range("StartRow").Value
StartColumn = Range("StartColumn").Value
Worksheets("Sensitivities").Select
Cells(EndRow - StartRow, EndColumn - StartColumm).ClearContents
ReDim Result(EndRow - StartRow, EndColumn - StartColumm)
Range("CalculationStartTime") = Time
For Row = StartRow To EndRow
Range(Range("ColumnInputVariableRangeName")) = Cells(Row, StartColumn - 1)
For Column = StartColumn To EndColumn
Result(Row, Column) = Range(Range("RangeOutputVariableRangeName")) 'Here I get the Run-time error 9: Subscript out of range
Call RefreshSeniorDebtAmount
Cells(Row, Column) = Range(Range("RangeOutputVariableRangeName"))
Next Column
Next Row
Cells(EndRow - StartRow, EndColumn - StartColumm) = Result 'Not sure if this will work either after solving the first error.
Range("CalculationEndTime") = Time
Calculate
End Sub