Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel arrows don't move black box but move the window Thebit Excel Discussion (Misc queries) 1 April 13th 09 02:06 AM
Can I Move replace instead of Move copy [email protected] Excel Discussion (Misc queries) 2 January 9th 08 10:25 PM
excel-how to get the spreadsheet to move as I move the scroll tab excel toiler Excel Discussion (Misc queries) 6 November 7th 07 06:07 PM
How do I stop making the spreadsht move when I move up/dwn/lt/rt? Manny Excel Worksheet Functions 4 April 7th 06 10:30 PM
When I move scroll bar in excell the contents do not move with it ramneek Excel Discussion (Misc queries) 2 June 29th 05 07:35 PM


All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"