Code to copy columns and insert down row across columns for a defined number

Joneedshelp

New Member
Joined
Sep 23, 2020
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello, I need to copy 20 rows (not including title) from one column (A2:A21) and then corresponding rows from another column (B2:B21), then the same first column (A2:B21) and the next column (e.g. C2:B21) etc. for 5 times (columns B-F) then move to the next lots of rows and do the same thing 20 rows (this time there is no title) from one column (A22:A41) and then corresponding rows from another column (B22:B41), then the same first column (A22:B41) and the next column (e.g. C22:B41) etc. for 5 times (columns B-F) for an undefined number of times until I run out of data (not all data collected yet. Please help
Data looks like this
1602833812464-png.24314

Etc.
Thanks for your help
Jo
 

Attachments

  • 1602833812464.png
    1602833812464.png
    31.9 KB · Views: 45
  • 1602833812583.png
    1602833812583.png
    31.9 KB · Views: 7

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hello,

you haven't specified where you want the new data to do, so have assumed it goes into col J

VBA Code:
Sub COPY_SPECIES()
    Application.ScreenUpdating = False
    For MY_ROWS = 2 To Range("A" & Rows.Count).End(xlUp).Row Step 20
        For MY_COLS = 2 To 6
            Cells(MY_ROWS, 1).Resize(20).Copy
            Range("J" & Range("J" & Rows.Count).End(xlUp).Offset(1, 0).Row).PasteSpecial (xlPasteValues)
            Cells(MY_ROWS, MY_COLS).Resize(20).Copy
            Range("K" & Range("K" & Rows.Count).End(xlUp).Offset(1, 0).Row).PasteSpecial (xlPasteValues)
        Next MY_COLS
    Next MY_ROWS
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
End Sub

is this any use?
 
Upvote 0

Forum statistics

Threads
1,214,932
Messages
6,122,331
Members
449,077
Latest member
jmsotelo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top