In the following code when setting the variable "Timeline", it's correct, for example "2017-03-10" but in R1C1 formula it's displayed as "2017-3-10". I changed Timeline in R1C1 formula to Format(Timeline,, "yyyy-mm-dd").No effect. Do you have an idea what I am doing wrong?
Code:
Dim Timeline As Date
With PlikHarmonogram.Sheets(1)
Timeline = Application.WorksheetFunction.Min(.Columns("E")) - 60
End With
.Cells(i, j).FormulaR1C1 = _
"=IF(AND(" & Timeline & "<=R4C," & Timeline & " >=R4C[-1])," & _
"VLOOKUP(RC2," & "'[" & PlikBudżet.Name & "]" & PlikBudżet.Sheets(1).Name & "'!R" & WierszKosztyPensji_Budzet + 2 & _
"C" & OstKol_Budzet & ":R" & WierszKosztyPensji_Budzet + 2 & "C" & OstKol_Budzet + 2 & ",3,0),"""")"