Date Stamp Need

H

Harvey Gersin

Several people need access to particular Excel Spreadsheets on a company server. Every time they open a sheet, we need to know the date and time that sheet was last accessed.

Is there a way to have the date and time register automatically when a sheet is opened or when information is placed in any cell within the sheet?

Help is appreciated.
 
N

Nick Hodge

Harvey

You could use some workbook_Sheetchange event code like so (This code goes in the ThisWorkbook module)

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
Range("A1").Value = Now()
Application.EnableEvents = True
End Sub

This will place the date and time on each worksheet in a workbook in which it is placed in A1 of the sheet changed

You could also switch on the track changes feature which writes to a hidden sheet and has much more detail than this

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
[email protected]


Several people need access to particular Excel Spreadsheets on a company server. Every time they open a sheet, we need to know the date and time that sheet was last accessed.

Is there a way to have the date and time register automatically when a sheet is opened or when information is placed in any cell within the sheet?

Help is appreciated.
 
H

Harvey Gersin

Sounds like this would work.

Unfortunately, I am not skilled in VBE which, I believe, is required.

Could you please provide a step-by-step instruction on what I need to do to get this code into my worksheet?

Thank you very much.

--
___________________
Harvey Gersin
[email protected]
Harvey

You could use some workbook_Sheetchange event code like so (This code goes in the ThisWorkbook module)

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
Range("A1").Value = Now()
Application.EnableEvents = True
End Sub

This will place the date and time on each worksheet in a workbook in which it is placed in A1 of the sheet changed

You could also switch on the track changes feature which writes to a hidden sheet and has much more detail than this

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
[email protected]


Several people need access to particular Excel Spreadsheets on a company server. Every time they open a sheet, we need to know the date and time that sheet was last accessed.

Is there a way to have the date and time register automatically when a sheet is opened or when information is placed in any cell within the sheet?

Help is appreciated.
 
N

Nick Hodge

Harvey

In your workbook, Press alt+F11. This will launch the VBE (Visual Basic Editor)on the left you should see an entry for 'ThisWorkbook', right click here and select view code.

Paste the code here

Close the VBE, save the workbook.

Bear in mind the code as written will overwrite anything in A1, change the code if you want somewhere different

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
[email protected]


Sounds like this would work.

Unfortunately, I am not skilled in VBE which, I believe, is required.

Could you please provide a step-by-step instruction on what I need to do to get this code into my worksheet?

Thank you very much.

--
___________________
Harvey Gersin
[email protected]
Harvey

You could use some workbook_Sheetchange event code like so (This code goes in the ThisWorkbook module)

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
Range("A1").Value = Now()
Application.EnableEvents = True
End Sub

This will place the date and time on each worksheet in a workbook in which it is placed in A1 of the sheet changed

You could also switch on the track changes feature which writes to a hidden sheet and has much more detail than this

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
[email protected]


Several people need access to particular Excel Spreadsheets on a company server. Every time they open a sheet, we need to know the date and time that sheet was last accessed.

Is there a way to have the date and time register automatically when a sheet is opened or when information is placed in any cell within the sheet?

Help is appreciated.
 
Top