+ Reply to Thread
Results 1 to 2 of 2

Add sequential numbers to copies of 1 sheet using BeforePrint event

  1. #1
    Registered User
    Join Date
    05-01-2020
    Location
    FL
    MS-Off Ver
    Office 365 v.1708, Excel 2016
    Posts
    2

    Add sequential numbers to copies of 1 sheet using BeforePrint event

    I want to print multiple copies (let's say 5) of the same sheet but with each copy being numbered sequentially (in cell A1).
    I want this to happen when I go to File>Print so that I am able to select the printer and properties in the regular fashion (and not through VBA).
    To start the code when I go to File>Print, I am using the BeforePrint Event then cycling though each copy and printing with the copy number.

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Dim i As Integer

    For i = 1 To 5
    Range("A1").Value = "'0" & i
    ActiveSheet.PrintOut
    Next i
    End Sub

    This seems to make an unwanted loop so that every time it calls ActiveSheet.PrintOut, it restarts the whole routine. Is there any way around this?

    It is important to me that I can print through the normal path File>Print, and that the copies are numbered sequentially.

    Thank you!

  2. #2
    Registered User
    Join Date
    05-01-2020
    Location
    FL
    MS-Off Ver
    Office 365 v.1708, Excel 2016
    Posts
    2

    Re: Add sequential numbers to copies of 1 sheet using BeforePrint event

    Found this same situation and it solved the problem!

    excelforum.com/excel-programming-vba-macros/798836-endless-loop-when-using-beforeprint-event.html

    Correction:

    Application.EnableEvents = False
    ActiveSheet.PrintOut
    Application.EnableEvents = True

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Beforeprint event
    By DevilNava in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-21-2017, 02:44 PM
  2. Endless Loop When Using BeforePrint Event
    By PosseJohn in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-29-2011, 09:35 PM
  3. Sequential numbers and copies
    By PSU41 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-12-2011, 01:26 PM
  4. VBA Application Event - BeforePrint
    By jeremyhamblen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-22-2009, 04:29 AM
  5. Replies: 1
    Last Post: 12-07-2008, 12:21 PM
  6. [SOLVED] BeforePrint Event
    By Woody in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2005, 05:05 AM
  7. [SOLVED] print multiple copies of the same page with sequential numbers
    By labrat in forum Excel General
    Replies: 1
    Last Post: 06-14-2005, 01:05 PM

Tags for this Thread

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