merging row based on unique value in colum A

  • im newbie for vba programming, i have more than 44K rows of data and have 3 column A,B,C. and i want to merge that based on column A as key. i used code from this forum in this link http://www.ozgrid.com/forum/showthread.php?t=156024, my problem is code always return error 400 when i executed this


    basically my file contain data like here


    A B C
    12 a b
    12 c d
    13 a ee
    .
    .
    .


    my goal file like here
    A B C
    12 a,c b,d
    13 a ee
    .
    .
    .
    more details for my file in attachment
    can give me solution? thanks so much

  • Re: merging row based on unique value in colum A


    OK jindon i put in "Result" sheet for result. oh ya jindon i get your code from other thread but when applied ur code in my file that have more than 44k rows the code resulterror message 400.. here my file jindon. because my file have large size i cant upload file above 1MB here, i upload it in other place here for that link jindon http://www.mediafire.com/view/?cxpegpci6fkmj61 thanks jindon for ur reply

  • Re: merging row based on unique value in colum A


    Quote from jindon;663691

    Working.............


    jindon why in my computer when i try ur file show error message runtime error :"1004" whats wrong in my excel programs?

  • Re: merging row based on unique value in colum A


    Then try change

    Code
    With Sheets("result").Cells(1).Resize(n, UBound(a, 2)) 
             '.Columns("r").NumberFormat = "@"
            .Value = a 
            .EntireColumn.AutoFit 
        End With


    to

    Code
    With Sheets("result").Cells(1)
            For i = 1 To n
                For ii = 1 To UBound(a, 2)
                    .Cells(i, ii).Value = a(i, ii)
                Next
            Next
            .CurrentRegion.EntireColumn.AutoFit
        End With
  • Re: merging row based on unique value in colum A


    Quote from jindon;663705

    Then try change

    Code
    With Sheets("result").Cells(1).Resize(n, UBound(a, 2)) 
             '.Columns("r").NumberFormat = "@"
            .Value = a 
            .EntireColumn.AutoFit 
        End With


    to

    Code
    With Sheets("result").Cells(1)
            For i = 1 To n
                For ii = 1 To UBound(a, 2)
                    .Cells(i, ii).Value = a(i, ii)
                Next
            Next
            .CurrentRegion.EntireColumn.AutoFit
        End With


    i didnt understand why in few days ago when i run this code

    Code
    With Sheets("result").Cells(1).Resize(n, UBound(a, 2)) 
             '.Columns("r").NumberFormat = "@"
            .Value = a 
            .EntireColumn.AutoFit 
        End With


    i always got error message.
    but now both of code above its work perfectly,
    thanks jindon for ur help its very nice code and very helpful for me thanks jindon youre best...

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!