Reputation: 75
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".
Upvotes: 5
Views: 14205
Reputation: 35863
There are two options for you:
.FormulaLocal
property: wks.Cells(z, "K").FormulaLocal = fZeit
,
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
Upvotes: 12