ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to move to next row? (https://www.excelbanter.com/excel-programming/345728-how-move-next-row.html)

Rick Billingsley

How to move to next row?
 
I have a macro that copies/pastes data from a row into a form then prints the
form. How do get this to repeat for all of the rows in the table?

TIA

Tom Ogilvy

How to move to next row?
 
Dim cell as Range
for each cell in Range("Table").columns(1).Cells
cell.Resize(1,Range("Table").columns.count).copy _
Destination:=worksheets("Form").Range("A3")
Worksheets("Form").Printout
Next

--
Regards,
Tom Ogilvy


"Rick Billingsley" <Rick wrote in
message ...
I have a macro that copies/pastes data from a row into a form then prints

the
form. How do get this to repeat for all of the rows in the table?

TIA




Rick Billingsley[_2_]

How to move to next row?
 
Tom,

Thanks for the response. I am no programmer so I'm going to need a little
more help.

Here is a section of the macro. This repeats for about 10 different data
elements that are not contiguous within the row.

Sub Populate2005Data()
'
' Populate2005Data Macro
' Macro recorded 11/16/2005 by Rick Billingsley
'
'
Sheets("2005 elections").Select
Range("A18").Select
Selection.Copy
Sheets("Side One").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("B18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("G6:I6").Select
ActiveSheet.Paste

End Sub


Tom Ogilvy

How to move to next row?
 
Sub Populate2005Data()
'
' Populate2005Data Macro
' Macro recorded 11/16/2005 by Rick Billingsley
'
'
Dim sh as Worksheet, sh1 as Worksheet
Dim rw as Long
for rw = 2 to 25
Set sh = Worksheets("2005 Elections")
set sh1 = Worksheets("Side One")
Sh.Range("A" & rw).Copy sh.Range("A1")
sh.Range("B" & rw).Copy sh1.Range("G6:I6")
sh.Range("L" & rw).Copy sh1.Range("E14:H14")

sh.Range("M" & rw).Copy sh1.Range("E15:H15")
sh.Range("N" & rw).Copy sh1.Range("E16:H16")
sh.Range("O" & rw).Copy sh1.Range("E17:H17")
sh.Range("Q" & rw).Copy
sh1.Range("K23").PasteSpecial Paste:=xlPasteValues
sh.Range("R" & rw).Copy
sh1.Range("K24").PasteSpecial Paste:=xlPasteValues
Worksheets("Side One").PrintOut _
Copies:=1, Collate:=True
Next rw
End Sub

Change
for rw = 2 to 25

to reflect the rows you want printed.

--
Regards,
Tom Ogilvy



"Rick Billingsley" wrote in
message ...
Tom,

Thanks for the response. I am no programmer so I'm going to need a little
more help.

Here is a section of the macro. This repeats for about 10 different data
elements that are not contiguous within the row.

Sub Populate2005Data()
'
' Populate2005Data Macro
' Macro recorded 11/16/2005 by Rick Billingsley
'
'
Sheets("2005 elections").Select
Range("A18").Select
Selection.Copy
Sheets("Side One").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("B18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("G6:I6").Select
ActiveSheet.Paste

End Sub




Rick Billingsley[_2_]

How to move to next row?
 
Thanks a million!! That works great!




"Tom Ogilvy" wrote:

Sub Populate2005Data()
'
' Populate2005Data Macro
' Macro recorded 11/16/2005 by Rick Billingsley
'
'
Dim sh as Worksheet, sh1 as Worksheet
Dim rw as Long
for rw = 2 to 25
Set sh = Worksheets("2005 Elections")
set sh1 = Worksheets("Side One")
Sh.Range("A" & rw).Copy sh.Range("A1")
sh.Range("B" & rw).Copy sh1.Range("G6:I6")
sh.Range("L" & rw).Copy sh1.Range("E14:H14")

sh.Range("M" & rw).Copy sh1.Range("E15:H15")
sh.Range("N" & rw).Copy sh1.Range("E16:H16")
sh.Range("O" & rw).Copy sh1.Range("E17:H17")
sh.Range("Q" & rw).Copy
sh1.Range("K23").PasteSpecial Paste:=xlPasteValues
sh.Range("R" & rw).Copy
sh1.Range("K24").PasteSpecial Paste:=xlPasteValues
Worksheets("Side One").PrintOut _
Copies:=1, Collate:=True
Next rw
End Sub

Change
for rw = 2 to 25

to reflect the rows you want printed.

--
Regards,
Tom Ogilvy



"Rick Billingsley" wrote in
message ...
Tom,

Thanks for the response. I am no programmer so I'm going to need a little
more help.

Here is a section of the macro. This repeats for about 10 different data
elements that are not contiguous within the row.

Sub Populate2005Data()
'
' Populate2005Data Macro
' Macro recorded 11/16/2005 by Rick Billingsley
'
'
Sheets("2005 elections").Select
Range("A18").Select
Selection.Copy
Sheets("Side One").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("B18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("G6:I6").Select
ActiveSheet.Paste

End Sub






All times are GMT +1. The time now is 10:36 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com