Thread: Looping Macro
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
jase jase is offline
external usenet poster
 
Posts: 117
Default Looping Macro

This is exactly what I need. Thank you.

"Sandy Mann" wrote:

Try something like:

Sub Test()
p = 10 '<- Change to the number of Rows
'you want to go down before pasting

Application.ScreenUpdating = False

For r = 23 To 323 Step 50
Range("S" & r & ":U" & r).Copy
Range("S" & r + p).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
Next r

Application.ScreenUpdating = True
End Sub


--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Jase" wrote in message
...
This does not work. It is only copying the starting range scrolling down
and
pasting it and then copying the same data and scrolling another 50 cells
and
pasting it again. I need it to grab range S23:U23 copy scroll down like 10
rows paste scroll down another 50 from the initial S23:U23. So we r now at
S73 copy this date scroll down 10 rows from here and paste that data. Then
go
dow to S123 copy that data scroll down 10 and paste and so on and so on.
"Mike H" wrote:

Possibly

Sub Stitution()
For x = 23 To 73 Step 50
Range("S" & x & ":U" & x).Select
Application.CutCopyMode = False
Selection.Copy
Range("S" & x + 50).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Next
End Sub

Mike

"Jase" wrote:

I have recorded a macro that selects a certain range then pastes into a
certain range then scrolls down about 50 cells and does the same thing.
Is
there a way to loop this instead of always selecting particular ranges?

example of macro....

Range("S23:U23").Select
Application.CutCopyMode = False
Selection.Copy
Range("S63").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("S73:U73").Select
Application.CutCopyMode = False
Selection.Copy
Range("S123").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False