Results 1 to 5 of 5

Thread: Transpose A Column Of Data In To A Table

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    This will collate the data in a new sheet

    Code:
    Sub Consolidator()
    
        Dim rngInput As Range
        Dim lng As Long, lngCol As Long
        Set rngInput = Worksheets("Sheet1").Range("A2:A15000")
        Worksheets.Add After:=Sheets(Sheets.Count)
        For Each rngInput In rngInput
            If IsEmpty(rngInput) Then Exit For
            If rngInput.Font.Bold Then
                lng = lng + 1
                lngCol = 1
            Else
                lngCol = lngCol + 1
            End If
            Sheets(Sheets.Count).Cells(lng, lngCol).Value = rngInput.Value
        Next rngInput
        
    End Sub
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2
    Junior Member
    Join Date
    May 2013
    Posts
    3
    Rep Power
    0
    thank you for solving....

    Have you tried this code in the attached file..????

    i had a runtime error "1004"
    application defined or object defined


    when i had debug program it has shown yellow background behind the following line of code

    Sheets(Sheets.Count).Cells(lng, lngCol).Value = rngInput.Value

    i think in this line there is some problem...
    Attached Images Attached Images

Similar Threads

  1. Replies: 34
    Last Post: 03-13-2015, 02:26 PM
  2. Replies: 2
    Last Post: 04-16-2013, 01:36 PM
  3. Replies: 2
    Last Post: 06-14-2012, 04:10 AM
  4. Transpose data into Rows
    By vikash200418 in forum Excel Help
    Replies: 2
    Last Post: 04-10-2012, 11:02 PM
  5. Replies: 9
    Last Post: 03-13-2012, 01:27 PM

Tags for this Thread

Posting Permissions

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