Results 1 to 3 of 3

Thread: Transpose data into Rows

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    5
    Rep Power
    0

    Lightbulb Transpose data into Rows

    Hi Admin,

    Sorry to post my requirement in this thread as I am very new to this forum and still to find the way to post a new thread.

    I am using MS office 2007, windows XP professional

    I am in urgent need of a macro. the requirements are as follows:

    Copies different columns (a msg box to ask how many columns to copy) and paste under one column in a destination (input box to ask for the destination) for pasting the copied data.

    I tried using clipboard and recording a macro but this does not seem to work perfectly

    Column1 Column2 Column3 Column4
    A B C D
    A B C D
    A B C D
    A B C D
    A B C D


    Solution should look like:
    New Column
    A
    A
    A
    A
    A
    B
    B
    B
    B
    B
    C
    C
    C
    C
    C
    D
    D
    D
    D
    D


    I have tried this macro but this is not fullfiling my requirements

    Code:
    Sub Macro1()
    '
    ' Macro1 Macro
    '
    ' 
    Range(Selection, Selection.End(xlDown)).Select
    Selection.Copy
    ActiveCell.Offset(0, 1).Range("A1").Select
    End Sub
    Hope, I get the solution to my problem.

    Thank you so much in advance.

    Thanks,
    Vikash
    Last edited by Admin; 04-10-2012 at 03:39 PM. Reason: code tag added

  2. #2
    Administrator Admin's Avatar
    Join Date
    Mar 2011
    Posts
    1,122
    Rep Power
    10
    Hi Vikash,

    Welcome to board !

    Please post questions in appropriate forum. This time I have moved the post for you. In future care to post in appropriate forum. Also use code tags while posting codes.
    Cheers !

    Excel Range to BBCode Table
    Use Social Networking Tools If You Like the Answers !

    Message to Cross Posters

    @ Home - Office 2010/2013/2016 on Win 10 (64 bit); @ Work - Office 2016 on Win 10 (64 bit)

  3. #3
    Forum Guru Rick Rothstein's Avatar
    Join Date
    Feb 2012
    Posts
    659
    Rep Power
    13
    You asked this same question in the MrExcel forum where I gave you this macro to do what you want...

    Code:
    Sub RepeatCopyRectangularRange()
      Dim X As Long, Z As Long, RowCount As Long, ColCount As Long
      Dim ColRng As Variant, SourceStartCell As Range, Destination As Range
      Set SourceStartCell = Selection(1)
      RowCount = Selection.Rows.Count
      ColCount = Selection.Columns.Count
      On Error GoTo NoDestination
      Set Destination = Application.InputBox("Select the starting cell on the destination sheet.", Type:=8)
      On Error GoTo 0
      If Not Destination Is Nothing Then
        For X = 1 To ColCount
          ColRng = Cells(SourceStartCell.Row, SourceStartCell.Column + X - 1).Resize(RowCount)
          Destination.Offset(RowCount * (X - 1)).Resize(RowCount) = ColRng
        Next
      End If
    NoDestination:
    End Sub

Similar Threads

  1. Replies: 34
    Last Post: 03-13-2015, 02:26 PM
  2. Move data from rows into columns for every unique value
    By mahmoud-lee in forum Excel Help
    Replies: 4
    Last Post: 06-13-2013, 03:02 AM
  3. Transpose A Column Of Data In To A Table
    By gunjan.nasit in forum Excel Help
    Replies: 4
    Last Post: 05-20-2013, 12:33 AM
  4. Replies: 2
    Last Post: 04-16-2013, 01:36 PM
  5. Replies: 2
    Last Post: 06-14-2012, 04:10 AM

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
  •