excel - Run-time error '1004', Placing a formula in a acell -
===
edit: answer seems highlight has more syntax foo else
===
all i'm trying put formula in cell. it's formula developed before using vba , need automate process.
when run code it's fine until gets line.
then receive error- run-time error '1004': application-defined or object-defined error
the code contained in loop context or school boy errors i've made.
sheets("data summary").activate dim startdate date startdate = now() dim integer = 1 7 startdate = dateadd("d", 1, startdate) cells.range("b9").formula = "=countifs(discharged!$e$2:$e$200, " & _ " "">="" & startdate, " & _ " discharged!$e$2:$e$200, " & _ " ""<"" & startdate.adddays(1), " & _ " discharged!$h$2:$h$200, " & _ " ""<24"" " 'here error next
i've split formula separate lines it's easier read doesn't work if put on 1 line either. if edit formula there space before = code runs formula doesn't activated sheet, sits there value.
i've had @ formulalocal function , formular1c1 doesn't seem achieve different result.
any appreciated.
try one:
range("b9").formula = "=countifs(discharged!$e$2:$e$200," & """>=" & startdate & """, discharged!$e$2:$e$200, " & _ " ""<" & dateadd("d", 1, startdate) & """, discharged!$h$2:$h$200, ""<24"")"
Comments
Post a Comment