Consulting

Results 1 to 5 of 5

Thread: Solved: Merge rows with same Info in to one

  1. #1
    VBAX Mentor
    Joined
    Aug 2008
    Posts
    323
    Location

    Solved: Merge rows with same Info in to one

    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
    I am a Newbie, soon to be a Guru

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Why is the data straddling two lines, makes it harder than it needs to be.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Mentor
    Joined
    Aug 2008
    Posts
    323
    Location
    you mean why is the description and wkmx descrioption in two lines?

    That is what the raw data I get.
    I am a Newbie, soon to be a Guru

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Mentor
    Joined
    Aug 2008
    Posts
    323
    Location
    I am looking in to that.
    Thanks for the HELP XLD
    I am a Newbie, soon to be a Guru

Posting Permissions

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