VBA: Copy column data and paste with every nth rows

epano

New Member
Joined
Jul 20, 2018
Messages
3
Hello. Could someone help me out with a vba code. I am currently learning vba but i cannot figure out how to code this issue.

I am trying to copy data in a column on one sheet (sheet1), then paste it on another sheet (sheet2), but this time, evenly spaced out every 9 rows. The number of data rows could differ each time so it has to be able to find the last row with data. Also, in sheet 2, where I paste the first data cell is not the same as in sheet1. I have provided an example below to make it easier to understand.

Thanks!

Current (Sheet 1)
ABC
1Name
2Address
3Telephone
4Mobile

<tbody>
</tbody>

Need (Sheet 2) - i used less rows in between data here but for the actual issue i need data to be placed every 9th row
ABC
1
2Name
3
4
5
6Address
7
8
9
10Telephone
11
12
13
14Mobile

<tbody>
</tbody>
Note: the letters and numbers are column and row identifiers (A1, B2, etc.). Not column headers. There are no column headers in the actual file.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Hi & welcome to MrExcel
How about
Code:
Sub CopySkipRws()
   Dim i As Long, r As Long
   Dim Rng As Range
   
   With Sheets("sheet1")
      Set Rng = .Range("A1", .Range("A" & Rows.Count).End(xlUp))
   End With
   For i = 2 To Rng.Count * 9 Step 9
      r = r + 1
      Sheets("Sheet2").Range("B" & i).Value = Rng(r).Value
   Next i
End Sub
 
Upvote 0
Hi are you able to copy over the formatting as well? e.g. i want the font to be bold.
and are you able to copy and paste to merge cells with skprws?
 
Upvote 0
Hi & welcome to MrExcel.
Please start a thread of your own for this question.Thanks
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,928
Members
449,094
Latest member
teemeren

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