Repeat Transpose - Repeat amount of Rows.

  • Hi Guys.


    I have a range of data in excel that is currently in 1 column, with sets of 32 rows.


    If I transpose set of data (32 rows) it puts them into 32 columns, 1 row the page, this is what I want to achieve for the whole range of data.


    But I need the sets (which are in 1 column) to be listed underneath each other.


    I understand I need a VB script but I am kinda new to VB and its beyond me.


    I have attached a copy of the dummy data - and how I want it to look in the long run.


    Any advice/Help Appreacited.


    Kyle

  • Re: Repeat Transpose - Repeat amount of Rows.


    See if this is how you wanted

    Code
    Sub test()
        Dim i As Long, n As Long
        With Sheets("sheet1")
            For i = 1 To .Range("a" & Rows.Count).End(xlUp).Row Step 32
                n = n + 2
                .Cells(i, 1).Resize(32).Copy
                Sheets("sheet2").Cells(n, 1).Resize(2).PasteSpecial Transpose:=True
            Next
        End With
    End Sub
  • Re: Repeat Transpose - Repeat amount of Rows.


    Hi webtechhosts,


    Welcome to Ozgrid!!


    See how this goes:



    Regards,


    Robert

  • Re: Repeat Transpose - Repeat amount of Rows.


    Hi.. try this one too.



  • Re: Repeat Transpose - Repeat amount of Rows.


  • Re: Repeat Transpose - Repeat amount of Rows.


    Hi webtechhosts..


    I just noticed some variations in your data structure that would affect the output if not handled.


    At first glance.. your data is in sets of 32 rows.. starting with "WebFlags" and ending with "Revisions".. but.. looking closer.. in your second last set.. there is an extra value (TypeofPatient).


    Also.. the order of the values within each set is not the same.


    I'll try to get some time tomorrow to look at an alternative solution.

  • Re: Repeat Transpose - Repeat amount of Rows.


    Yeah I noticed the same thing - can you imagine what 20000 rows of data ends up looking like using the other method.

  • Re: Repeat Transpose - Repeat amount of Rows.


    Quote from webtechhosts;758295

    Y20000 rows of data


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!