copying rows

Q

Qwerty

I'm hoping someone here can help with this. I'm trying to copy rows from a
database sheet to a printable form sheet one row at a time.

My database sheet will have any number of rows on a given day that I would
like to copy to row 38 on a printable form sheet. This row is linked to fill
in the form before printing.

The problem is that I would like to copy the rows from the database sheet to
row 38 on the form sheet one row at a time, stopping at the last row with
data.

Basically just a copy,print,copy,print,copy,print,etc. to the last row with
data.

I can't use a range because I will have a different number of rows daily.

I hope this makes sense.

TIA
qwerty
 
J

J.E. McGimpsey

one way:

Public Sub CopyAndPrint()
Dim cell As Range
Dim destRange As Range
Set destRange = Sheets("PrintForm").Range("A38")
With Sheets("Database")
For Each cell In .Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
cell.EntireRow.Copy destRange
destRange.Parent.PrintOut
Next cell
End With
End Sub
 
S

Stuart

the following assumes that your data is held on a sheet called "datasheet"
and begins in cell "A1" and is continuous in column "A" until the last row
with data


Sheets("datasheet").Select
Range(Range("A1"), Range("A1").End(xlDown)).Select
For Each rng In Selection
Rows(rng.Row).Copy
Sheets("printsheet").Range("A38").PasteSpecial (xlPasteAll)
'your print out code here
Next rng
 
Q

Qwerty

WORKS GREAT! THANX

J.E. McGimpsey said:
one way:

Public Sub CopyAndPrint()
Dim cell As Range
Dim destRange As Range
Set destRange = Sheets("PrintForm").Range("A38")
With Sheets("Database")
For Each cell In .Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
cell.EntireRow.Copy destRange
destRange.Parent.PrintOut
Next cell
End With
End Sub
 
Q

Qwerty

Thanks. Does what I need.

Stuart said:
the following assumes that your data is held on a sheet called "datasheet"
and begins in cell "A1" and is continuous in column "A" until the last row
with data


Sheets("datasheet").Select
Range(Range("A1"), Range("A1").End(xlDown)).Select
For Each rng In Selection
Rows(rng.Row).Copy
Sheets("printsheet").Range("A38").PasteSpecial (xlPasteAll)
'your print out code here
Next rng


sheet
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top