LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default repeat macro for all rows

Rick,

Assuming that your data starts in row2, and you want to print out the data from each row (where
column A is filled - no empty cells in column A): try the macro below. If you need help modifying
it, post back.

HTH,
Bernie
MS Excel MVP

Sub Populate2005DataVer2()
Dim shtData As Worksheet
Dim shtPrintOut As Worksheet
Dim myRow As Long

Set shtPrintOut = Sheets("Side One")
Set shtData = Sheets("2005 elections")

For myRow = 2 To shtData.Cells(Rows.Count, 1).End(xlUp).Row
shtPrintOut.Range("A6:E6").Value = _
shtData.Range("A" & myRow).Value
shtPrintOut.Range("G6:I6").Value = _
shtData.Range("B" & myRow).Value
shtPrintOut.Range("E14:H14").Value = _
shtData.Range("L" & myRow).Value
shtPrintOut.Range("E15:H15").Value = _
shtData.Range("M" & myRow).Value
shtPrintOut.Range("E16:H16").Value = _
shtData.Range("N" & myRow).Value
shtPrintOut.Range("E17:H17").Value = _
shtData.Range("O" & myRow).Value
shtPrintOut.Range("E18:H18").Value = _
shtData.Range("P" & myRow).Value
shtPrintOut.Range("K23").Value = _
shtData.Range("Q" & myRow).Value
shtPrintOut.Range("K24").Value = _
shtData.Range("R" & myRow).Value
shtPrintOut.PrintOut Copies:=1, Collate:=True

Next myRow

End Sub


"Rick Billingsley" wrote in message
...


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
Sheets("2005 elections").Select
Range("L18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("E14:H14").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("M18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("E15:H15").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("N18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("E16:H16").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("O18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("E17:H17").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("P18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("E18:H18").Select
ActiveSheet.Paste
Sheets("2005 elections").Select
Range("Q18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("K23").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("2005 elections").Select
Range("R18").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Side One").Select
Range("K24").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Side One").Select
Range("A6:E6").Select
Worksheets("Side One").PrintOut Copies:=1, Collate:=True



End Sub





"Bernie Deitrick" wrote:

Rick,

Post your code....

HTH,
Bernie
MS Excel MVP


"Rick Billingsley" wrote in message
...
I have a macro that copies/pastes row data into a form then prints the form.
How do I get the macro to repeat for all rows in the table?

TIA






 
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
repeat two rows macro please jwmbem New Users to Excel 3 March 9th 08 04:02 PM
need macro :repeat rows at top jwmbem New Users to Excel 0 March 8th 08 07:33 PM
need macro script - repeat to delete 2 rows BB Excel Discussion (Misc queries) 3 November 14th 06 12:00 AM
macro to repeat a formula a set number of rows apart steveo Excel Discussion (Misc queries) 1 July 10th 06 09:21 PM
macro to repeat a formula a set number of rows apart steveo Excel Discussion (Misc queries) 0 July 10th 06 12:46 AM


All times are GMT +1. The time now is 07:14 PM.

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

About Us

"It's about Microsoft Excel"