View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
RJD RJD is offline
external usenet poster
 
Posts: 6
Default Update date & time in a cell only when worksheet is changed

Mike,

Thanks for your reply to my question. I'm new to "writing code" to
accomplish something like this Excel. I followed your instructions but may
have missed something obvious to a more experience user.

I pasted the code you provided in the window as you instructed, and changed
("A1") to ("G1") so the date & time would be in the G1 cell of my first
worksheet. I selected ALT+F11 again to go back to the worksheet and nothing
appears in G1 of worksheet 1. I'm sure your code is right and it's something
I'm doing wrong.

Since I want the date & time in each worksheet, wouldn't I select the
specific sheet instead of "ThisWorkbook" and paste the code?

I may need a little more detail in how to use VB editor this first time to
get this right.

Thanks,

RJD


"Mike H" wrote:

Hi,

You need code for that. ALT+F11 to open VB editor. Double click
'ThisWorkbook and paste the code below in on the right. Change the cell to
the one you want

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

Mike

"RJD" wrote:

I have a workbook with multiple worksheets. I'd like to have the time & date
in a cell in each worksheet update only when information in that worksheet is
changed. I don't change each worksheet each time I use the workbook. I tried
=NOW(), but it changes the time and date in each worksheet.