• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

Coding a varible into the R1C1 formula format in AB for applications.

Need to code a sum formula into a cell using R1c1 formula

The foruula will be placed in row 3.  The range will be from row 5 to the last row of data in the column (lRow).
All in the same column. What I have does not work:

 fRow = 5
  lRow = Range("A65535").End(xlUp).Row
  pA = "=sum(R[2]C:R[lRow]C)"
  Cells(fRow - 2, 242).FormulaR1C1 = pA

 I receive a run-time error "10004". Prgram works if I substite a number for lrow but I need a varible tht changes daily and want to keep lRow

  • 2
1 Solution
Harisha M GCommented:
pA = "=sum(R[2]C:R[" & lRow & "]C)"
VFioramontiAuthor Commented:
Thank you - of course. Big time help
Harisha M GCommented:
Thanks for the grade !

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now