Tags: copies, excel, form, macro, microsoft, msdn, pastes, prints, repeat, row, rows, software, theform
How to move to next row?
On Microsoft » Microsoft Excel
4,823 words with 4 Comments; publish: Fri, 06 Jun 2008 12:14:00 GMT; (30662.50, « »)
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
http://excel.itags.org/q_microsoft-excel_248103.html
All Comments
Leave a comment...
- 4 Comments

- 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 Billingsley.excel.itags.org.discussions.microsoft.com> wrote in
message news:F608E2AB-78FE-4C4D-8872-B26EE1E08562.excel.itags.org.microsoft.com...
> 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
#1; Fri, 06 Jun 2008 12:15:00 GMT

- 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
#2; Fri, 06 Jun 2008 12:16:00 GMT

- 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" <RickBillingsley.excel.itags.org.discussions.microsoft.com> wrote in
message news:47B877CC-766B-4F05-8805-BC4D116B8E5A.excel.itags.org.microsoft.com...
> 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
>
#3; Fri, 06 Jun 2008 12:17:00 GMT

- 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" <RickBillingsley.excel.itags.org.discussions.microsoft.com> wrote in
> message news:47B877CC-766B-4F05-8805-BC4D116B8E5A.excel.itags.org.microsoft.com...
>
>
#4; Fri, 06 Jun 2008 12:18:00 GMT