pasting an array to the next blank location...

Andymann

New Member
Joined
Feb 24, 2002
Messages
20
I have an array of data B2:H183. I wish to write a macro that will select the array, and copy it to J2:P183. That's easy. My problem is, next week, I want to use the same macro, but the array must be copied to R2:X183. The following week it must be copied to Z2. And so on. I've tried IF and AND statements, but this only seems to work up to a point.
Any other suggestions?

Thanks, much appreciated!

Andymann
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
On 2002-09-17 01:42, Andymann wrote:
I have an array of data B2:H183. I wish to write a macro that will select the array, and copy it to J2:P183. That's easy. My problem is, next week, I want to use the same macro, but the array must be copied to R2:X183. The following week it must be copied to Z2. And so on. I've tried IF and AND statements, but this only seems to work up to a point.
Any other suggestions?

Thanks, much appreciated!

Andymann

Hi Andymann,

this macro will do it:
Sub copyWeekly()
Range("B2:H183").Copy
'find last cell in use in row 2 and select 2 cells to the right
Range("IV2").End(xlToLeft).Offset(0, 2).Select
ActiveSheet.Paste
End Sub

Note: H2 must contain something
 
Upvote 0

Forum statistics

Threads
1,203,356
Messages
6,054,938
Members
444,759
Latest member
TeckTeck

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