0

I'm currently trying to use an integer variable into a Sum formula using VBA. I've referenced this question as well as this question and implemented the subsequent recommendations but I'm still getting a Syntax error when I try to run the sub.

My code is the following:

Sub Sum_Column()
Dim fRow As Integer
fRow = Cells(Rows.Count, 2).End(xlUp).Row
Cells(fRow + 1, 2).Formula = "=SUM(B2:B"fRow")"
End Sub

Any help you can provide will be greatly appreciated.

W.Harr
  • 303
  • 1
  • 4
  • 15

1 Answers1

0

The error is in the part

"SUM(B2:B"fRow")"

It should be

"SUM(B2:B" & fRow & ")"
Rob Anthony
  • 1,743
  • 1
  • 13
  • 17