Share via

How To Copy / Paste Multiple Data "Blocks" Using Paste Special / Transpose - Need Advice

Infoman 0 Reputation points
2026-06-12T16:31:45.6366667+00:00

Hello, Excel Community...

I've got a situation that hopefully someone can direct me on.

The scenario:Screenshot 2026-06-12 111932

Column A represents 2 lines (in this test) from a 3rd-party program - hence, two "data blocks" for lack of a better term. For each line / block of data, I want to create a separate row. When I did a copy on the 2 line block and did a paste special => transpose, it did make a column for each line of data - but it put the second line of data on that same first line. I'd like, if possible, to have each line / block from column A "transposed" into a separate line with 12 columns. I know - why not copy / paste each line and transpose, rinse and repeat? Because in my case, I have hundreds - if not thousands - of lines to do, and it's not feasible to copy / paste / transpose data block by data block.

Does anyone know if my scenario is doable?

Thank you !

[Moderator note: Personally Identifiable Information removed] 

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments

2 answers

Sort by: Most helpful
  1. Kai-L 14,210 Reputation points Microsoft External Staff Moderator
    2026-06-12T18:23:32.14+00:00

    Dear @Infoman,

    Good day, and thank you for reaching out to the Q&A Forum.

    I appreciate the clear explanation of your issue. I understand that you have repeating blocks of 12 rows in Column A, and you would like to transpose each block into one row with 12 columns. From my research, there are several possible ways to achieve this in Excel. Below are two approaches that may help, depending on your Excel version and whether you prefer using a formula or VBA.

    Please try the following options:

    1.Use a modern Excel formula

    If you are using Microsoft 365 Excel and have access to the WRAPROWS function, you can use this formula In cell B1(or wherever you want the output):

    =WRAPROWS(FILTER(A1:A10000,A1:A10000<>""),12,"")

    This formula takes all non-blank values from Column A and wraps them into rows of 12 columns.

    Notes:

    • Enter the formula only in B1.
    • Do not copy it down.
    • Make sure the output area, such as B1:M1000, is empty before entering the formula; otherwise, Excel may return a #SPILL! error.

    User's image If WRAPROWS is not available in your Excel version, you can try this alternative formula instead:

    =LET(data,FILTER(A1:A10000,A1:A10000<>""),n,12,numBlocks,QUOTIENT(ROWS(data),n),INDEX(data,SEQUENCE(numBlocks,,0)*n+SEQUENCE(,n)))

    2.Use VBA

    1. Press Alt + F11 to open the VBA Editor.
    2. Go to Insert > Module.
    3. Paste the code below into the new module.
    Sub TransposeBlocksOf12()
     Dim ws As Worksheet
     Dim LastRow As Long
     Dim BlockSize As Long
     Dim Data As Variant
     Dim Result() As Variant
     Dim r As Long
     Dim NonBlankCount As Long
     Dim OutputRows As Long
     Dim OutputRow As Long
     Dim OutputCol As Long
     Dim LastOutputRow As Long
     Dim c As Long
     Dim CellText As String
     Set ws = ActiveSheet
     BlockSize = 12
     ' Find last row in Column A
     LastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
     ' Read Column A into memory
     Data = ws.Range("A1:A" & LastRow).Value
     ' Count non-blank cells
     For r = 1 To UBound(Data, 1)
     If Not IsError(Data(r, 1)) Then
     If Trim(CStr(Data(r, 1))) <> "" Then
     NonBlankCount = NonBlankCount + 1
     End If
     End If
     Next r
     If NonBlankCount = 0 Then
     MsgBox "No data found in Column A.", vbExclamation
     Exit Sub
     End If
     ' Calculate how many output rows are needed
     OutputRows = Application.WorksheetFunction.RoundUp(NonBlankCount / BlockSize, 0)
     ' Prepare output array
     ReDim Result(1 To OutputRows, 1 To BlockSize)
     OutputRow = 1
     OutputCol = 1
     ' Fill output array
     For r = 1 To UBound(Data, 1)
     If Not IsError(Data(r, 1)) Then
     CellText = Trim(CStr(Data(r, 1)))
     If CellText <> "" Then
     Result(OutputRow, OutputCol) = CellText
     OutputCol = OutputCol + 1
     If OutputCol > BlockSize Then
     OutputCol = 1
     OutputRow = OutputRow + 1
     End If
     End If
     End If
     Next r
     Application.ScreenUpdating = False
     Application.EnableEvents = False
     ' Clear previous output from B:M only
     For c = 2 To 13
     LastOutputRow = Application.Max(LastOutputRow, ws.Cells(ws.Rows.Count, c).End(xlUp).Row)
     Next c
     ws.Range(ws.Cells(1, 2), ws.Cells(Application.Max(LastOutputRow, OutputRows), 13)).ClearContents
     ' Write result starting from B1
     ws.Range("B1").Resize(OutputRows, BlockSize).Value = Result
     Application.EnableEvents = True
     Application.ScreenUpdating = True
     MsgBox "Transpose completed successfully!" & vbCrLf & _
     OutputRows & " rows created starting from B1.", vbInformation
    End Sub
    

    After pasting the code:

    1. Close the VBA Editor.
    2. Press Alt + F8.
    3. Select TransposeBlocksOf12, then click Run.

    Notes:

    • The macro reads the values from Column A.
    • The output starts from B1.
    • It groups every 12 non-blank values into one row.
    • It clears the previous output in B:M before writing the new result, so old results do not remain.
    • Please run the macro on a copy of your workbook first, just to be safe.

    I hope this information is helpful. Please try the steps above and let me know how it goes. If you run into any issue, feel free to share more details, and I’ll be happy to continue assisting. Thank you for your patience and understanding. I look forward to your reply.Have a wonderful day!


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

    Was this answer helpful?


  2. AI answer

    2026-06-12T16:32:04.31+00:00

    This scenario is not achievable with a single built‑in Paste Special → Transpose operation. Transpose always converts one contiguous source range into a single contiguous destination range, so multiple “blocks” stacked in one column will always be transposed into one long row (or one block of rows) rather than one row per block.

    To automate converting repeating 12‑row blocks from a single column into separate rows, a formula or script (for example, using Power Query, VBA, or the Excel JavaScript API’s Range.copyFrom with transpose set appropriately) is required; Paste Special alone cannot perform the repeated block‑by‑block transpose.


    References:

    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.