Excel 2010 VBA Error 1004 with formula
excel, excel-2010, excel-formula, vba
Solution
There are two options for you:
- use `.FormulaLocal` property: `wks.Cells(z, "K").FormulaLocal = fZeit`
- use comma `,` as separator instead of semicolon `;` (even if your local settings require `;` as standard separator):
fZeit = "=IF(ISBLANK(H" & z & "),((A" & z & "*B" & z & "*I" & z & ")-I" & z & ")+(A" & z & "*B" & z & "*J" & z & "),(A" & z & "*B" & z & "*H" & z & "))"
wks.Cells(z, "K").Formula = fZeit
Problem
I have this code: ``` Dim fStrecke As String fStrecke = "=A" & z & "*B" & z & "*C" & z wks.Cells(z, "L").Formula = fStrecke Dim fZeit As String fZeit = "=IF(ISBLANK(H" & z & ");((A" & z & "*B" & z & "*I" & z & ")-I" & z & ")+(A" & z & "*B" & z & "*J" & z & ");(A" & z & "*B" & z & "*H" & z & "))" wks.Cells(z, "K").Formula = fZeit ``` The first formula is working and for the second i get an runtime error 1004. any idea? i have formatted the column K as user defined with "m:ss".