1

I need to add up the total for column L, I know the first and last rows:

lRow = Cells(Rows.Count, 2).End(xlUp).Row
fRow = Cells(lRow, "B").Value

So how do I use lRow and fRow in my SUM?

1 Answer 1

3
activecell.Formula = "=SUM(L" & lrow & ":L" & frow & ")"

Edit - Added:

Sub Assign
  dim dbl_assign as long

  lRow = Cells(Rows.Count, 2).End(xlUp).Row
  fRow = Cells(lRow, "B").Value

  activecell.Formula = "=SUM(L" & lrow & ":L" & frow & ")"

  dbl_assign = activecell.value

end sub
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks - how would I use that to assign the value retrieved by the formula to a variable in the VBA?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.