Hi
This is pretty clunky but should get you there.
Sub aaa()
Range("C:C,F:F,I:I").ClearContents
endrow = Cells(Rows.Count, 1).End(xlUp).Row
For i = endrow To 3 Step -1
If IsEmpty(Cells(i - 1, 1)) Then
Cells(i, 3).Formula = "=A" & endrow & "-A" & i
endrow = i - 2
End If
Next i
endrow = Cells(Rows.Count, 4).End(xlUp).Row
For i = endrow To 3 Step -1
If IsEmpty(Cells(i - 1, 4)) Then
Cells(i, 6).Formula = "=D" & endrow & "-D" & i
endrow = i - 2
End If
Next i
endrow = Cells(Rows.Count, 7).End(xlUp).Row
For i = endrow To 3 Step -1
If IsEmpty(Cells(i - 1, 7)) Then
Cells(i, 9).Formula = "=G" & endrow & "-G" & i
endrow = i - 2
End If
Next i
End Sub
You will have to make sure that the breaks in the driving columns (A,D,G) are blanks, not the spaces that you currently have in some of the cells. Also, row 2 will also have to be blank. As an example A13 is blank, but A9 has a space.
HTH
rylo
Bookmarks