changes to macro to inlcude additional columns

sangsterexcell

New Member
Joined
Dec 11, 2014
Messages
11
I have this macro I found that is very close to what I have however I have a couple of extra columns. I need to combine my column D and add the totals in F, G and H. The information from the rest of the columns A.B,C and E just need to have the information shown.

This is the macro below I found that combined columns A and added D,E and F. What changes need to be made?

Sub MergeData()
Dim LR As Long, i As Long

Application.ScreenUpdating = False
i = 2
LR = Range("A" & Rows.Count).End(xlUp).Row
Do
IFind = Cells(i, 1)
sAmt = WorksheetFunction.SumIf(Range("A:A"), IFind, Range("D:D"))
sAmt2 = WorksheetFunction.SumIf(Range("A:A"), IFind, Range("E:E"))
sAmt3 = WorksheetFunction.SumIf(Range("A:A"), IFind, Range("F:F"))
Cells(i, 4) = sAmt
Cells(i, 5) = sAmt2
Cells(i, 6) = sAmt3
SR = Cells(i + 1, 1).Address(False, False)
Range("A:A").AutoFilter Field:=1, Criteria1:="=" & IFind

x = WorksheetFunction.CountIf(Range("A:A"), Range("A" & i))
If x > 1 Then
Range(SR & ":A" & LR).EntireRow.Delete
End If
Range("A:A").AutoFilter

i = i + 1
LR = Range("A" & Rows.Count).End(xlUp).Row
If LR = i Then GoTo 0

Loop Until IsEmpty(Cells(i, 1))
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top