Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to add 1 to a numerical cell (A1) everytime the
worksheet is printed. Any thoughts? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open at same sheet everytime | Excel Discussion (Misc queries) | |||
how can I open an excel file everytime on certain sheet? | Excel Discussion (Misc queries) | |||
Excel - need an serial # to update everytime sheet is printed. | Excel Worksheet Functions | |||
Excel Sheet Only Prints a Line | Excel Discussion (Misc queries) | |||
auto numbering an exel work book sheet everytime it opens or print | Excel Discussion (Misc queries) |