Results 1 to 4 of 4

Macro to SumIF a reference Quantity

Threaded View

  1. #1
    Registered User
    Join Date
    08-01-2012
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    12

    Question Macro to SumIF a reference Quantity

    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
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1