Does anyone know why I would be getting this error? It worked fine before I added 7 additional ranges and 7 additional strings. I've limited the rows to run from 13 to 20 for a test but it worked running 700 lines without an issue before adding ranges and strings to expand to other columns:
Thanks much...
Code:
Sub Calculate_ActFcstBudLY()
Dim i As Integer
Dim rng1 As Range, rng2 As Range, rng3 As Range, rng4 As Range, rng5 As Range, rng6 As Range, rng7 As Range, rng8 As Range
Dim Dpndnt1 As String, Dpndnt2 As String, Dpndnt3 As String, Dpndnt4 As String, Dpndnt5 As String, Dpndnt6 As String, Dpndnt7 As String, Dpndnt8 As String, Dpndnt9 As String
Dim DeptNo As String
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
.EnableEvents = False
.DisplayAlerts = False
End With
For i = 13 To 20
Set rng1 = Range("L" & i)
Set rng2 = Range("N" & i)
Set rng3 = Range("P" & i)
Set rng4 = Range("R" & i)
Set rng5 = Range("U" & i)
Set rng6 = Range("W" & i)
Set rng7 = Range("Y" & i)
Set rng8 = Range("AA" & i)
Dpndnt1 = Left(Range("L" & i).Formula, 4)
Dpndnt2 = Left(Range("N" & i).Formula, 4)
Dpndnt3 = Left(Range("P" & i).Formula, 4)
Dpndnt4 = Left(Range("R" & i).Formula, 4)
Dpndnt5 = Left(Range("U" & i).Formula, 4)
Dpndnt6 = Left(Range("W" & i).Formula, 4)
Dpndnt7 = Left(Range("Y" & i).Formula, 4)
Dpndnt8 = Left(Range("AA" & i).Formula, 4)
Dpndnt9 = Range("J" & i)
If Dpndnt1 = "=SUM" Or Dpndnt9 = "Skip" Then
If Dpndnt2 = "=SUM" Or Dpndnt9 = "Skip" Then
If Dpndnt3 = "=SUM" Or Dpndnt9 = "Skip" Then
If Dpndnt4 = "=SUM" Or Dpndnt9 = "Skip" Then
If Dpndnt5 = "=SUM" Or Dpndnt9 = "Skip" Then
If Dpndnt6 = "=SUM" Or Dpndnt9 = "Skip" Then
If Dpndnt7 = "=SUM" Or Dpndnt9 = "Skip" Then
If Dpndnt8 = "=SUM" Or Dpndnt9 = "Skip" Then
GoTo CellSkip
Else
'Calculate Month Actuals
rng1.FormulaR1C1 = "omitted"
'Calculate Month Forecast
rng2.FormulaR1C1 = "omitted"
'Calculate Month Budget
rng3.FormulaR1C1 = "omitted"
'Calculate Month Last Year
rng4.FormulaR1C1 = "=SUMIF(R4C110:R4C121,R4C18,RC[92]:RC[103])"
'Calculate YTD Actuals
rng5.FormulaR1C1 = "=RC[23]"
'Calculate YTD Forecast
rng6.FormulaR1C1 = "=RC[47]"
'Calculate YTD Budget
rng7.FormulaR1C1 = "=RC[71]"
'Calculate YTD Last Year
rng8.FormulaR1C1 = "=RC[95]"
'rng.Value = rng.Value
End If
CellSkip:
Next i
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
.EnableEvents = True
.DisplayAlerts = True
End With
End Sub
Thanks much...