PDA

View Full Version : Solved: Merge rows with same Info in to one



nepotist
03-13-2009, 10:38 AM
Hi,

Please find the attached Spread Sheet. It has the following columns.
Year, Ph, Description,Fund,Estimated and Ftype. I would like to merger rows with same Year(or with in a range),same description,Same PH#,same FType in to one and the estimated column should be a summation of the all the cells meeting the above criteria.

Can some one help me with that
Thank you

Bob Phillips
03-13-2009, 11:12 AM
Why is the data straddling two lines, makes it harder than it needs to be.

nepotist
03-13-2009, 11:33 AM
you mean why is the description and wkmx descrioption in two lines?

That is what the raw data I get.

Bob Phillips
03-13-2009, 12:11 PM
Public Sub ProcessData()
Dim i As Long, j As Long
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For i = LastRow - 1 To 1 Step -1

If .Cells(i + 1, "A").Value = .Cells(i, "A").Value And _
.Cells(i + 1, "B").Value = .Cells(i, "B").Value And _
.Cells(i + 1, "C").Value = .Cells(i, "C").Value And _
.Cells(i + 1, "K").Value = .Cells(i, "K").Value Then

.Cells(i, "J").Value = .Cells(i, "J").Value + .Cells(i + 1, "J").Value
.Rows(i + 1).Delete
End If
Next i
End With
End Sub

nepotist
03-13-2009, 12:29 PM
I am looking in to that.
Thanks for the HELP XLD