Try to paste this code on VBA module, then run sub tes

Sub Tes()
    Dim Src, Res, LRow As Long, Id, ColCust As New Collection, ColID

    Src = Range("A2").CurrentRegion.Offset(1)
    ReDim Res(1 To UBound(Src, 1), 1 To Columns.Count)
    ReDim ColID(0 To Columns.Count)

    For LRow = 1 To UBound(Src, 1)
        Id = CustID(ColCust, Src(LRow, 1)) '+ 1
        ColID(Id) = ColID(Id) + 1
        Res(Id, 1) = Src(LRow, 1)
        Res(Id, (ColID(Id) + 1)) = Src(LRow, 2)
    Next

    'Write The Result
Range("E3").Resize(ColCust.Count, WorksheetFunction.Max(ColID) + 1) = Res
End Sub


Function CustID(ByRef ColCust As Collection, ByVal CustNo As String) As Long
    Dim Tmp As Long

    On Error Resume Next
    ColCust.Add CustNo, CustNo

    For Tmp = 1 To ColCust.Count
        If CStr(ColCust.Item(Tmp)) = CustNo Then
            CustID = Tmp
            Exit For
        End If
    Next
End Function

On 23-10-2013 21:49, Koti wrote:
Hi all,

I have an excel file in which I have a uniq numbers column and contact number column.

Each unique number has few different contact numbers and for each unique number separate row is created.

I have to make it a single row with all contact numbers in the same row.

Here is the file and required result:

*
*       
        
        
        
*cust no.*      contact num     
        
        
*S458*  12345   
        
        
*S458*
        54321   
        
        
*S379*  6789    
        
        
*S379*
        7896    
        
        
*S379*
        98745   
        
        
*S379*
        7852    
        
        
*S259*  2548    
        
        
*S259*
        3654    
        
        
*S259*
        1548    
        
        
*5060*  3658    
        
        

        
        
        
        

        
        
        
        
*Required*      *
*       *
*       *
*       *
*
*
*       *
*       *
*       *
*       *
*
*S458*
        *12345*         *54321*         *
*       *
*
*S379*
        *6789*  *7896*  *98745*         *7852*
*S259*
        *2548*  *3654*  *1548*  *3658*

        
        
        
        


Help is appreciated.
Thank you all.

--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss.
---
You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.

--
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to