I have a query of data that I need to reorgainize using a macro. I basically need to sumif colum L "TEAM" by referencing it's quantity in column G but the kicker is that I need an absolute value. Then, I need to copy the accounts that make up the sum and place it under the amount column D in worksheet "allocation". I need to loop this through data that will always change. The attached shows my end result better. Your help with be greatly appreciated. Thank you.
Here is what I have so far but doesn't seem to work.
Sub Option_Event_Writer()
Dim r As Long, lr As Long, n As Long
Application.ScreenUpdating = False
lr = Cells(Rows.Count, 1).End(xlUp).Row
For r = 3 To lr
n = Application.CountIf(Columns(12), Cells(r, 12).Value)
If n > 1 Then
Cells(r, 7).Value = Application.Sum(Range(Cells(r, 7), Cells(r + n - 1, 7))) 'sum up the quantity column and the row below it.
lr = Cells(Rows.Count, 1).End(xlUp).Row 'resets the counter
End If
Next r
Application.ScreenUpdating = True
End Sub
Bookmarks