+ Reply to Thread
Results 1 to 4 of 4

Help: How to transpose data (Complicated)

Hybrid View

  1. #1
    Registered User
    Join Date
    08-27-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Unhappy Help: How to transpose data (Complicated)

    Dear All, Please help...

    I have a list of contact copy from internet, but all information is in one column A1 only. I need to seperate out into A1, B1, C1, D1, E1. Is there anyway to speed up??

    Example,

    A1
    A company
    Address 1
    Address 2
    State, Country
    Telephone
    B company
    Address 1
    Address 2
    State, Country
    Telephone
    C company
    Address 1
    Address 2
    State, Country
    Telephone

    Now I have to copy and paste special by transpose every 5 column...
    A1 B1 C1 D1 E1
    A Company Address 1 Address 2 State, Country Telephone
    B Company Address 1 Address 2 State, Country Telephone
    C Company Address 1 Address 2 State, Country Telephone

    Please help....

  2. #2
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Help: How to transpose data (Complicated)

    hi,

    each company has 5 values always? no blank cells in the middle?

    Thanks

  3. #3
    Registered User
    Join Date
    08-27-2013
    Location
    Malaysia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Help: How to transpose data (Complicated)

    Quote Originally Posted by fredlo2010 View Post
    hi,

    each company has 5 values always? no blank cells in the middle?

    Thanks
    Yup, always 5 value and no spacing in between.. any idea?

  4. #4
    Valued Forum Contributor fredlo2010's Avatar
    Join Date
    07-04-2012
    Location
    Miami, United States
    MS-Off Ver
    Excel 365
    Posts
    762

    Re: Help: How to transpose data (Complicated)

    Hi,

    See if this helps. Please modify to meet your specific needs

    Sub PasteTranspose()
    
    Dim shTarget As Worksheet
    Dim lRow As Long
    Dim lrowTarget As Long
    Dim i As Long
    
    'create the Summary sheet
    ThisWorkbook.Sheets.Add after:=Sheets(Sheets.Count)
    On Error GoTo Err1
    ActiveSheet.Name = "Summary"
    Set shTarget = ActiveSheet
    
    'add the headers
    Sheets("Summary").Cells(1, "A").Resize(1, 5).Value = Array("Company", "Address 1", _
                                                                "Address 2", "State, County", _
                                                                "Telephone")
    
    'count the rows in "Sheet1" or the sheet you have the data initally
    lRow = Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row
    
    'loop through the cells and add the values
    With shTarget
        For i = 1 To lRow Step 5
            'determine whats the last row the data will be going to
            lrowTarget = .Cells(Rows.Count, "A").End(xlUp).Row + 1
                    
            Sheets("Sheet1").Cells(i, "A").Resize(5, 1).Copy
            shTarget.Cells(lrowTarget, "A").PasteSpecial Transpose:=True
        Next
    End With
    Exit Sub
    
    Err1:
    Application.DisplayAlerts = False
        ActiveSheet.Delete
    Application.DisplayAlerts = True
    
    MsgBox "There is a sheet named: ""Summary"" in the workbook. Delete or rename to preoceed", _
            vbInformation + vbOKOnly, "Duplicate Sheet"
    End Sub
    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Excel 2007 Transpose (Complicated)
    By martha3553 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-07-2013, 12:07 AM
  2. Complicated Transpose Macro
    By ebdmbfan in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-19-2013, 03:38 PM
  3. [SOLVED] very complicated transpose
    By gherzberg in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 10-15-2012, 01:01 PM
  4. Replies: 3
    Last Post: 06-05-2011, 06:56 AM
  5. HUGE table that needs complicated transpose
    By idawg in forum Excel General
    Replies: 3
    Last Post: 05-19-2010, 03:30 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1