Application error

  • Thread starter Thread starter salgud
  • Start date Start date
S

salgud

Does anybody see what's wrong with this code:

with ws
.Cells(7, 10).Formula =
"=IF(.cells(7,8)<>"""",DATEDIF(.cells(7,8),.cells(7,9),""d"")+1)"
end with

Thanks
 
maybe this

ws.Cells(7, 10).Formula = "=IF($H$7<>"""",DATEDIF($H$7,$I$7,""d"")+1)"

Regards,
Peter T
 
"=IF(" & .cells(7,8).address & "<>"""",DATEDIF(" & .cells(7,8).address & ","
& .cells(7,9).address & ",""d"")+1)"
 
Does anybody see what's wrong with this code:

with ws
.Cells(7, 10).Formula =
"=IF(.cells(7,8)<>"""",DATEDIF(.cells(7,8),.cells(7,9),""d"")+1)"
end with

Thanks

I think I figured it out. Can't do a ws.cells in a worksheet formula. Think
I have to do and offset instead. Any other ways?
 
Back
Top