VBA to count rows in a sheet and increase counter on another sheet then print

L

lgj32

I have a dataset which could have a variable number of rows on a sheet
called "Data", on the first sheet I have a template which shows all the
data for that record and in cell A1 the record number (starts at 1).

I need the Template sheet number to increase by one each time, print
then increase the number and print gain until it reaches the end of the
records on the "data" sheet.

At the moment I am manually typing in the record number and printing,
but there must be a simplier way by using VBA to automate this. I
haven't used macros for years and years so am very rusty can anybody
help?

Thanks
 
B

Bob Phillips

Is this because you just want the row number of copies, if so why not just
use

Dim iLastRow As Long
iLastRow = Worksheets("data").End(xlUp).Row
Worksheets("data").PrintOut copies:=iLastRow


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 

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