Simple 2007 Excel Macro Question

bfraser

Board Regular
Joined
Apr 15, 2006
Messages
113
I need to know how to write a simple macro for Excel 2007 that .....copies a series of dates from the top of a worksheet (see below) and inserts them into cells further down a worksheet at intervals of 35.


ColumnB
Row 65 Sunday, January 1, 2012
Row 66 Saturday, December 31, 2011
Row 67 Friday, December 30, 2011
Row 68 Thursday, December 29, 2011

Row 437 Sunday, January 1, 2012
Row 472 Saturday, December 31, 2011
Row 507 Friday, December 30, 2011
Row 542 Thursday, December 29, 2011
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
I don't see how the row numbers in your example follow the description in the text.
 
Upvote 0
Try this........(it's based on your input....)

Code:
Sub CopyStuff()
Dim Interval As Long, j As Long, i As Long
Interval = 35
j = 437
Range("A65:A68").Copy
For i = 1 To 4
Cells(j, 1).PasteSpecial xlPasteValues
j = j + Interval
Next i
End Sub
 
Upvote 0
Almost.........
The macro copied all of the four dates to each of the four locations, rather than copying the first date to the first location, the second date to the second location etc.
 
Upvote 0
ahhhhh, to do that try:


Code:
Sub CopyStuff()
Dim Interval As Long, j As Long, i As Long
Application.ScreenUpdating = False
Interval = 35
j = 437
For i = 65 To 68   'Your row numbers of your copied base cells
Cells(i, 2).Copy
Cells(j, 2).PasteSpecial xlPasteAll
j = j + Interval
Next i
Application.CutCopyMode = False
Range("B65").Select
Application.ScreenUpdating = True
MsgBox "Cells copied down"
End Sub
 
Upvote 0
Unfortunately, it still doesn't work.
It brings up the MsgBox and the hour glass and nothing else happens,,,,,
 
Upvote 0
It worked fine for me,, lotta good that is to you..

Comment out (place " ' " in front of the 3rd row application.screenupdating..."

and then STEP thru the code (Pressing the F8 function Key) watching S/S as it
progresses thru. If you get an error (r/t) - post it here!!

Jim
 
Upvote 0
Jim, are you able to send me your email address so I can forward you my worksheet with your suggested macro?
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,275
Members
452,902
Latest member
Knuddeluff

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