I'm trying to run down through a very long/variable Column Y and add a SUM formula of the cells in
Columns J:X to all blank cells in which the row also has an account number in Column A. (I've attached a truncated example of
the spreadsheet). Basically, if there is a blank spot in the totals column that also has an account in column A, I need to
sum a bunch of the values in between.
Here's a code I've written so far. I tried to add an active cell formula to
this to allow the macro to work on any column but had even worse results. Any help would be greatly appreciated.
Dim rCell, rColumn As Range
Dim lLastRow As Long
lLastRow = Range("Y65536").End(xlUp).Offset(0, 0).Row
Set rColumn = Range("Y1:Y" & lLastRow)
For Each rCell In rColumn
If IsEmpty(rCell) Then
If rCell.Offset(0, -25).Value Empty Then
rCell.Formula = "=SUM(J:X,rCell.row)"
If you like these VB formatting tags please consider sponsoring the author in support of injured Royal Marines