Range.Cells function with formula

  • I keep getting an error when trying to use the code below (Compile error - expected: end of statement). If I replace the text string " weeks" with an integer the code works fine. What am I doing wrong?

    Cells(LastRow + 6, "A").Formula = "=CONCATENATE(ROUND(DAYS(A" & LastRow + 5 & ",TODAY())/7,0)," Weeks")"
  • You need to double-up the quotes inside the formula like

    Cells(LastRow + 6, "A").Formula = "=CONCATENATE(ROUND(DAYS(A" & LastRow + 5 & ",TODAY())/7,0),"" Weeks"")"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!