• 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


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

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