+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Transpose address List

  1. #1
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Transpose address List

    How do I transpose a vertical list 3300 rows into a horizontal rows make address labels? The macro I have used in the past is not working.
    Sub address()
    Dim myAreas As Areas, myArea As Range
    With Range("a1", Range("a" & Rows.Count).End(xlUp))
        On Error Resume Next
        Set myAreas = .SpecialCells(2).Areas
    End With
    On Error GoTo 0
    If myAreas Is Nothing Then Exit Sub
    For Each myArea In myAreas
        With myArea
            If .Rows.Count > 1 Then
                .Cells(1, 2).Resize(, .Rows.Count).Value = Application.Transpose(.Value)        Else
                .Cells(1, 2).Value = .Value
            End If
        End With
    Next
    
    End Sub
    Thank you.
    Last edited by Leith Ross; 01-20-2012 at 06:25 PM. Reason: Added Code Tags

  2. #2
    Forum Guru pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2010
    Posts
    5,155

    Re: Transpose address List

    Hi LGRANT

    the codes good but the else was in the wrong line

    try

    Sub address()
    Dim myAreas As Areas, myArea As Range
    With Range("a1", Range("a" & Rows.Count).End(xlUp))
        On Error Resume Next
        Set myAreas = .SpecialCells(2).Areas
    End With
    On Error GoTo 0
    If myAreas Is Nothing Then Exit Sub
    For Each myArea In myAreas
        With myArea
            If .Rows.Count > 1 Then
                .Cells(1, 2).Resize(, .Rows.Count).Value = Application.Transpose(.Value) 
           Else
                .Cells(1, 2).Value = .Value
            End If
        End With
    Next
    End Sub
    regards pike

    If the solution helped please donate
    here to the RSPCA

    Sites worth visiting;

    J&R Solutions - royUK

    AJP Excel Information - Andy Pope

    Spreadsheet Toolbox

    VBA for smarties - snb

  3. #3
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Transpose address List

    Thanks Pike. Not having any luck. I will look at the sites you suggest.

  4. #4
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Transpose address List

    Thanks Pike. Not having any luck. I will look at the sites you suggest.

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Transpose address List

    I suggest you post a small sample workbook.

  6. #6
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Transpose address List

    File attached. 6 sheets to go. Thank you.
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Transpose address List

    The problem is that the last 32,000-odd rows don't have any blanks between them!

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Transpose address List

    The problem is that the last 32,000-odd rows don't have any blanks between them!

  9. #9
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Transpose address List

    UGH, thank you!

  10. #10
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Transpose address List

    So you have to tell us the logic for deciding where a new address starts.

  11. #11
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Transpose address List

    After the row with a date in it.

  12. #12
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Transpose address List

    After the row with a date in it.

  13. #13
    Registered User
    Join Date
    01-20-2012
    Location
    NYC
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Transpose address List

    got rid of the dates and some of the list transpses, but I get the 400 error. any ideas?

  14. #14
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Transpose address List

    Suggest you post a revised workbook so we can see what you've done.

  15. #15
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    3,788

    Re: Transpose address List

    Suggest you post a revised workbook so we can see what you've done.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0