+ Reply to Thread
Results 1 to 4 of 4

Increment number in cell when printing

Hybrid View

  1. #1
    Registered User
    Join Date
    05-09-2013
    Location
    Brighouse, west Yorkshire
    MS-Off Ver
    Excel 2003
    Posts
    2

    Increment number in cell when printing

    Hi, can I increment a number in a cell every time that page is printed? (it's just a 1 page sheet)

    Thanks

  2. #2
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Increment number in cell when printing

    Hi, something like this...

    Sub ShowPrintCopies()
    
    'Print active sheet
    ActiveSheet.PrintOut
    
    'If cell is empty then enter 0
    If Range("A2").Value = "" Then
    Range("A2").Value = 0
    End If
    
    'Increment copies value
    Range("A2").Value = Range("A2").Value + 1
    End Sub

  3. #3
    Registered User
    Join Date
    05-09-2013
    Location
    Brighouse, west Yorkshire
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Increment number in cell when printing

    Thanks Nu2Java, looks good, very much appreciate your help, will try this when I get back into work

  4. #4
    Forum Contributor
    Join Date
    04-03-2012
    Location
    Washington State
    MS-Off Ver
    Excel 365
    Posts
    340

    Re: Increment number in cell when printing

    I wasn't sure if you are printing from the menu in the worksheet or printing from code. If you are printing from the menu in the worksheet then you can place this in "ThisWorkbook"

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    
    'If cell is empty then enter 0
    If Range("A1").Value = "" Then
    Range("A1").Value = 0
    End If
    
    'Increment copies value
    Range("A1").Value = Range("A1").Value + 1
    
    End Sub

+ 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