• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

to adjust sumifs macro on another worksheet

RAM72

Member
Hi All

Need help to adjust a sumifs macro on data_1 and summary1 report red sheet tab using same principle as data and summary sheet green tabs but columns range differ .

Only qty has been added on red sheet tabs
as below code used on green tabs but to be adjusted on green tabs sampe principle applies only qty added .

Summary tab is advanced unique filter of data tab column Invoice tariff,description origin.

However for red tabs tariff description origin are sumifs criteria where qty and amount are sumed whereas green tabs uses invoice, tariff, description, origin are sumifs criteria

Thansks if anyone can help

Code:
Sub RAM()
Dim LastR As Long
Dim ws1 As Worksheet, ws2 As Worksheet
Set ws1 = Sheets("data")
Set ws2 = Sheets("summary")

LastR = ws1.Cells(Rows.Count, 1).End(xlUp).Row

ws2.Range("A1:E1").Value = ws1.Range("A1:E1").Value
ws2.Range(ws2.Range("A2"), ws2.Cells(LastR, 4)).Value = ws1.Range(ws1.Range("A2"), ws1.Cells(LastR, 4)).Value
ws2.Range(ws2.Range("A2"), ws2.Cells(LastR, 4)).RemoveDuplicates Columns:=Array(1, 2, 3, 4), Header:=xlNo
ws2.Range(ws2.Range("E2"), ws2.Cells(ws2.Cells(Rows.Count, 1).End(xlUp).Row, 5)).Value = _
=SUMIFS(data!C,data!C[-4],RC[-4],data!C[-3],RC[-3],data!C[-2],RC[-2],data!C[-1],RC[-1])

End Sub
 

Attachments

  • TEST SUMIFS .xlsx
    91.8 KB · Views: 3
Back
Top