VBA copy and paste down a column with offset

jacinthn

Board Regular
Joined
Jun 15, 2010
Messages
96
i have a formula that copies a range down a column as many times as i need, however i need to insert a gap or offset between each paste . this does it but it removes my header row and i cant figure out how to get it to do the offset and paste without removing the header each time... help please

Sub PasteDownFormat()
Dim x As Long, i As Long
x = x = x = i
x = InputBox("How many times")
If x < 1 Then Exit Sub
With Range("B1:B1243")
For i = 1 To x
Cells(i * 1243 + 1, 2).Resize(.Rows.Count + 1, .Columns.Count).Offset(1, 0).Value = .Offset(1, 0).Value
Next
End With
End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
i have a formula that copies a range down a column as many times as i need, however i need to insert a gap or offset between each paste . this does it but it removes my header row and i cant figure out how to get it to do the offset and paste without removing the header each time... help please

Sub PasteDownFormat()
Dim x As Long, i As Long
x = x = x = i
x = InputBox("How many times")
If x < 1 Then Exit Sub
With Range("B1:B1243")
For i = 1 To x
Cells(i * 1243 + 1, 2).Resize(.Rows.Count + 1, .Columns.Count).Offset(1, 0).Value = .Offset(1, 0).Value
Next
End With
End Sub
If the header is in B1 try changing this:
Code:
Cells(i * 1243 + 1, 2).Resize(.Rows.Count + 1, .Columns.Count).Offset(1, 0).Value = .Offset(1, 0).Value
to this:
Code:
Cells(i * 1243 + 1, 2).Resize(.Rows.Count + 1, .Columns.Count).Offset(1, 0).Value = .Value
 
Upvote 0
Thanks for the reply Joe when I try that it offsets the very first one it pastes then all the other ones are together with no gap/ offset between them
 
Upvote 0
Thanks for the reply Joe when I try that it offsets the very first one it pastes then all the other ones are together with no gap/ offset between them
This should do it:
Code:
Sub PasteDownFormat()
Dim x As Long, i As Long
x = InputBox("How many times")
If x < 1 Then Exit Sub
With Range("B1:B10")
For i = 1 To x
Cells(i * 10 + i, 2).Resize(.Rows.Count, .Columns.Count).Offset(1, 0).Value = .Value
Next
End With
End Sub
 
Upvote 0
Brilliant!!! thanks mate works like a charm. really appreciate the help.

Thank you!!!!!!!!!!!!! :)
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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