I can't for the life of me figure out why the XXX and YYY are not being replaced. When I run the macro I don't get any errors, but the formula still reads as it does in FormulaPart1.
Sub Test()
Dim FormulaPart1 As String
Dim FormulaPart2 As String
Dim FormulaPart3 As String
FormulaPart1 = "=SUM(IF(ISERROR(XXX),0,(YYY)))"
FormulaPart2 = "('Forecast - Budget Report'!R[1]C[-4]:R[989]C[7]*('Forecast - Budget Report'!R[1]C[12]:R[989]C[12]=""Rental Income"")*('Forecast - Budget Report'!R[-1]C[-4]:R[-1]C[7]<=R[-3]C[-4]))"
FormulaPart3 = "('Forecast - Budget Report'!R[1]C[-4]:R[989]C[7]*('Forecast - Budget Report'!R[1]C[12]:R[989]C[12]=""Rental Income"")*('Forecast - Budget Report'!R[-1]C[-4]:R[-1]C[7]<=R[-3]C[-4])"
With ThisWorkbook.Sheets("Budget Comparison").Range("F11")
.FormulaArray = FormulaPart1
.Replace "XXX", FormulaPart2
.Replace "YYY", FormulaPart3
End With
End Sub'
I appreciate the assistance here!
.Replace what:="XXX", replacement:=FormulaPart2, lookat:=xlpart