Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to +1 to a cell everytime the sheet prints?

I want to add 1 to a numerical cell (A1) everytime the
worksheet is printed. Any thoughts?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to +1 to a cell everytime the sheet prints?

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



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Geoff A" wrote in message
...
I want to add 1 to a numerical cell (A1) everytime the
worksheet is printed. Any thoughts?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default How to +1 to a cell everytime the sheet prints?

Hi,



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



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


--
JP

http://www.solutionsvba.com


"Geoff A" wrote in message
...
I want to add 1 to a numerical cell (A1) everytime the
worksheet is printed. Any thoughts?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to +1 to a cell everytime the sheet prints?

Does a printpreview count? It does in beforeprint - just a heads up.

--
Regards,
Tom Ogilvy

Geoff A wrote in message
...
Thanks, that worked perfect!!!
-----Original Message-----
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



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Geoff A" wrote in message
...
I want to add 1 to a numerical cell (A1) everytime the
worksheet is printed. Any thoughts?



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open at same sheet everytime Paul Excel Discussion (Misc queries) 2 April 4th 08 09:08 AM
how can I open an excel file everytime on certain sheet? Inas Excel Discussion (Misc queries) 1 June 7th 07 12:28 PM
Excel - need an serial # to update everytime sheet is printed. C. Excel Worksheet Functions 0 March 27th 06 09:21 PM
Excel Sheet Only Prints a Line Parker Excel Discussion (Misc queries) 7 September 12th 05 08:41 PM
auto numbering an exel work book sheet everytime it opens or print Rugby Al Excel Discussion (Misc queries) 1 July 19th 05 06:20 PM


All times are GMT +1. The time now is 11:21 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"