Search code examples
excelexcel-formulaexcel-2007

MS Excel 2007 : How do I increase number in a cell after every printout


I am printing an Excel document say 100 copies.

I have a field like "Copy No : "0001""

I need to increment this number after every printout so that every print has a Copy No: 0002, Copy No: 0003.....Copy No..0100

I mean to say when I give the print job and set it to 100 copies, the said number should increment and print automatically.

Is this possible using a Macro or some formulae ?? :)


Solution

  • Thanks to John Bustos original code, added some more and it works

    Sub PrintIncrement()
    
       Let x = 0
       Do While x < 100
       ActiveWindow.SelectedSheets.PrintOut Copies:=100, Collate:=True
       Dim num As Integer
       Range("L10").Select
       num = Range("L10").Value
       num = num + 1
       Range("L10").Value = num
       x = x + 1
       Loop
    
    End Sub