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

G

Geoff A

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

Chip Pearson

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
 
J

Jean-Paul Viel

Hi,



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



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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top