How to +1 to a cell everytime the sheet prints?

  • Thread starter Thread starter Geoff A
  • Start date Start date
G

Geoff A

I want to add 1 to a numerical cell (A1) everytime the
worksheet is printed. Any thoughts?
 
Geoff,

You can use the BeforePrint event procedure to do this. In the ThisWorkbook
code module, use the following code. Change the references to Sheet1 and
cell A1 to the appropriate sheet and cell.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ThisWorkbook.Worksheets("Sheet1").Range("A1")
.Value = .Value + 1
End With
End Sub
 
Hi,



In the module of ThisWorkbook in the event BeforePrint, have code like that:



Worksheets("sheet1").Range("a1") = Worksheets("sheet1").Range("a1") + 1
 
Back
Top