Excel: make macro or something ;) for this: input:

A________B________C

1________ 4

3________ 5

4________ 3

1________ 2

3________ 4

3________ 5

4________ 7

whish

A________B________C

1________ 4

1________ 2

__________________ 6

3________ 5

3________ 4

3________ 5

_________________14

4________ 3

4________ 7

_________________10

how to do this (automatic) with macro or ...

First, a posting tip: The next time you need to post data in this forum, please click on the

blue lineat the end of any of my posts and read the instructions found via that link. Thanks!Try this code:

Sub SortThenSum() 'Determine last row with data in Column A lastRw = Range("A" & Rows.Count).End(xlUp).Row 'Sort data Range("A1:B" & lastRw).Sort Key1:=Range("A1"), Order1:=xlAscending 'Initialize Row counter variable nxtRw = 1 'Loop through Rows Do While Cells(nxtRw, 1) <> "" 'Compare current Row data to next Row data (Column A) If Cells(nxtRw + 1, 1) <> Cells(nxtRw, 1) Then 'If they don't match, insert Row at change Cells(nxtRw + 1, 1).EntireRow.Insert 'Use SUMIF to SUM matching data, place in Column C Cells(nxtRw + 1, 3) = _ WorksheetFunction.SumIf(Range("A1:A" & lastRw), "=" & _ Cells(nxtRw, 1), Range("B1:B" & lastRw)) 'Increment Row counter and last Row variable to account for inserted Row nxtRw = nxtRw + 1 lastRw = lastRw + 1 End If 'Increment Row counter and check again nxtRw = nxtRw + 1 Loop End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Dear Sir! My Friend, Massa :) Thank You very much!

This is it!So, what book, tutorial you recommand me where can I find sintax, commands, words for makeing such routines?

Colour, bold fonts of subtotal (for example), strech cells, links routines etc.Thanks to You, again, and Computing.Net!

Bye!

I know that there are books and websites available to learn VBA but I have no suggestions since I am self-taught. Good luck!

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Ask Your Question

Weekly Poll

Do you think ride and car sharing are the future of transportation?

Discuss in The Lounge

Poll History