Date stamp in excel

stratis

Board Regular
Joined
Dec 10, 2012
Messages
65
Hi,

I would like to make a function that will keep automatically the date that I printed an excel worksheet.

For example I am thinking of a function that will appears the word "Pending" if I haven't print the sheet and the date that I print the sheet if it is printed.

I have find some thinks with iterations, but how they works?

Thank you in advance!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
How familiar are you with macros? In the Worksheet object there is a 'Before Print' event.

You can use this to set a cell to the date it was printed, with a default of 'Pending' if printing hasn't occurred.
 
Upvote 0
How familiar are you with macros? In the Worksheet object there is a 'Before Print' event.

You can use this to set a cell to the date it was printed, with a default of 'Pending' if printing hasn't occurred.

To be honest I am so familiar, but I would like to learn.. Could you please give some instrusctions how I could create it?
 
Upvote 0
It's difficult as I can't post screen shots.


  1. Name the cell you wish to display the print status in as "_PrintStatus" (I assume you know how to name a cell) and enter the text 'Pending'
  2. With the sheet active press Alt+[F11] to bring up the code window.
  3. On the left you should see the project explorer. If not Press Ctrl+R.
  4. Locate the "ThisWorkBook" object
  5. Double Click it
  6. Paste this code into the code window:

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
'Assuming the sheet you are printing is named Sheet1:

    If ActiveSheet.Name = "Sheet1" Then
            Range("_PrintStatus").Value = "Last Printed: " & Now
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,503
Messages
6,125,179
Members
449,212
Latest member
kenmaldonado

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top