+ Reply to Thread
Results 1 to 2 of 2

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

  1. #1
    lgj32
    Guest

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

    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


  2. #2
    Bob Phillips
    Guest

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

    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)

    "lgj32" <[email protected]> wrote in message
    news:[email protected]...
    > 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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1