ADD 1 TO CELL UPON PRINT

S

Sandra

I have a cell in a worksheet that I want to add 1 to each
time the page is printed.
For example 4300 this time, 4301 next time, 4302 next.
Any ideas?
 
B

Bernie Deitrick

Sandra,

Please don't post the same question multiple times. See my response to your
post in the programming group.

HTH,
Bernie
MS Excel MVP
 
J

Jason Morin

Try something like:

Sub Workbook_BeforePrint(Cancel As Boolean)
Dim rng As Range
Set rng = Sheets("Sheet1").Range("A1")
Cancel = True
rng.Value = rng.Value + 1
End Sub

--
Press Alt+F11, double-click on "ThisWorkbook" module, and
paste in the code above. Right now the code is set to
increment Sheet!A1 by 1.

HTH
Jason
Atlanta, GA
 
S

Sandra

I posted in both Worksheet functions and in Programming
because I didn't know if this could be solved without
programming. How else are you going to know which avenue
to take????
 
J

Jason Morin

Oops...take out that Cancel = True.

Jason
-----Original Message-----
Try something like:

Sub Workbook_BeforePrint(Cancel As Boolean)
Dim rng As Range
Set rng = Sheets("Sheet1").Range("A1")
Cancel = True
rng.Value = rng.Value + 1
End Sub

--
Press Alt+F11, double-click on "ThisWorkbook" module, and
paste in the code above. Right now the code is set to
increment Sheet!A1 by 1.

HTH
Jason
Atlanta, GA

.
 
B

Bernie Deitrick

Sandra,

You can cross post (one message to multiple groups), or you can rely on the
fact that most of the "responders" read most of the newsgroups. Starting new
threads just means more work, since the solution may be posted in one group
and not the other, and somebody may put out extra, unneeded effort.

HTH,
Bernie
MS Excel MVP
 

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