I'm trying to use a variable into formula using VBA. I've referenced How to pass an integer variable into a vba formula this question and tried implementing that in my if formula. =IF (startCell >0, startcell+confirmed, endcell+confirmed)
but I'm still unsure and getting an error.
My code is the following:
headerrow = 7
startCell = 8
endCell = 3
confirmed= 5
DDSS_Actual.Cells(headerrow + 3, 3).Formula = "=IF(" & startCell & ">" & endCell & ","& startCell & "+" &confirmed&", " & endCell & "+" &confirmed &")"
Thanks.