Hello,
The following loop seeks to sum values in col E for which identical text exists in col A. Is there a more efficient way to run this perhaps using For Next statement?
Thanks...
Sub JNLmacro()
Dim rng As Range, counter As Integer
Range("A2").Select
counter = 0
Do
Do
If ActiveCell.Value = ActiveCell(2, 1).Value Then
ActiveCell.Offset(1, 0).Select
counter = counter + 1
End If
Loop Until ActiveCell(2, 1).Value <> ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Insert
ActiveCell(1, 4).Value = "=SUM(D" & ActiveCell.Row - 1 & "
" & (ActiveCell.Row - 1) - counter & ")"
ActiveCell.Offset(1, 0).Select
counter = 0
Loop Until ActiveCell.Value = ""
End Sub
The following loop seeks to sum values in col E for which identical text exists in col A. Is there a more efficient way to run this perhaps using For Next statement?
Thanks...
Sub JNLmacro()
Dim rng As Range, counter As Integer
Range("A2").Select
counter = 0
Do
Do
If ActiveCell.Value = ActiveCell(2, 1).Value Then
ActiveCell.Offset(1, 0).Select
counter = counter + 1
End If
Loop Until ActiveCell(2, 1).Value <> ActiveCell.Value
ActiveCell.Offset(1, 0).Select
Selection.EntireRow.Insert
ActiveCell(1, 4).Value = "=SUM(D" & ActiveCell.Row - 1 & "
ActiveCell.Offset(1, 0).Select
counter = 0
Loop Until ActiveCell.Value = ""
End Sub