Results 1 to 8 of 8

*UPDATE* Rows of data to Columns of data *UPDATE*

Threaded View

a6ela *UPDATE* Rows of data to... 05-03-2010, 11:04 PM
rylo Re: Rows of data to Columns... 05-03-2010, 11:47 PM
Leith Ross Re: Rows of data to Columns... 05-04-2010, 12:06 AM
laaview Re: Rows of data to Columns... 05-04-2010, 12:29 AM
a6ela Re: Rows of data to Columns... 05-04-2010, 01:01 AM
a6ela Re: *UPDATE* Rows of data to... 05-04-2010, 03:00 AM
Leith Ross Re: *UPDATE* Rows of data to... 05-04-2010, 03:46 AM
Leith Ross Re: *UPDATE* Rows of data to... 05-04-2010, 11:30 AM
  1. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Rows of data to Columns of data

    Hello a6ela,

    Here is an automated VBA solution. The macro below copies the data in column "A" three rows at a time to columns "E:G" as single rows. A button has been added to the worksheet to run the macro.
    Sub RowsToColumns()
    
      Dim Cell As Range
      Dim Data() As Variant
      Dim N As Long, R As Long
      Dim Rng As Range
      Dim RngEnd As Range
      Dim Wks As Worksheet
      
        Set Wks = Worksheets("Sheet1")
        
        Set Rng = Wks.Range("A1")
        Set RngEnd = Wks.Cells(Rows.Count, Rng.Column).End(xlUp)
        Set Rng = IIf(RngEnd.Row < Rng.Row, Rng, Wks.Range(Rng, RngEnd))
        
        ReDim Data(1 To Rng.Rows.Count, 1 To 3)
        
          For R = 1 To Rng.Rows.Count Step 3
            N = N + 1
            Data(N, 1) = Rng.Item(R)
            Data(N, 2) = Rng.Item(R + 1)
            Data(N, 3) = Rng.Item(R + 2)
          Next R
          
        Wks.Range("E1:G1").Resize(UBound(Data, 1), UBound(Data, 2)).Value = Data
          
    End Sub
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

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.6.0 RC 1