Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Automating a date field to change on certain action

I have a date in a cell on a spread sheet.
it is useed by no clacsz - it just is a date to tell
everyoon ethe last time the sheet was changed.

I would like to automate this date so that it changes upon
any change in the sheet being made.

If the sheet is just opened and accessed then I need the
date to stay put.



It is a 2 or three sheet workbook - usually two

2 people have access to read write this sheet and the rest
have read only

Thanks for your time
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Automating a date field to change on certain action

Quite a commonly asked question.


Use the worksheet's change event to populate the date cell

Private Sub Worksheet_Change(ByVal Target As Range)
Static bUpdating As Boolean

If bUpdating Then
bUpdating = False
Else
bUpdating = True
Range("A1").Value = Format$(Date, "dd-mmm-yy HH:MM")
End If

End Sub


As the change is an event, setting adding the datestamp
will fire the event againg - hence the bolean flags this
and prevents an endless loop.

Change a cell
event fires
boolean is false, so set to true
add the date
event fires
the boolean is true, so reset it
end of second event
end of first event


HTH

Patrick Molloy
Microsoft Excel MVP





-----Original Message-----
I have a date in a cell on a spread sheet.
it is useed by no clacsz - it just is a date to tell
everyoon ethe last time the sheet was changed.

I would like to automate this date so that it changes

upon
any change in the sheet being made.

If the sheet is just opened and accessed then I need the
date to stay put.



It is a 2 or three sheet workbook - usually two

2 people have access to read write this sheet and the

rest
have read only

Thanks for your time
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Automating a date field to change on certain action

Hey thank you for the time

I assume this goes in "this work book" or is it in a
module.

T
-----Original Message-----
Quite a commonly asked question.


Use the worksheet's change event to populate the date cell

Private Sub Worksheet_Change(ByVal Target As Range)
Static bUpdating As Boolean

If bUpdating Then
bUpdating = False
Else
bUpdating = True
Range("A1").Value = Format$(Date, "dd-mmm-yy HH:MM")
End If

End Sub


As the change is an event, setting adding the datestamp
will fire the event againg - hence the bolean flags this
and prevents an endless loop.

Change a cell
event fires
boolean is false, so set to true
add the date
event fires
the boolean is true, so reset it
end of second event
end of first event


HTH

Patrick Molloy
Microsoft Excel MVP





-----Original Message-----
I have a date in a cell on a spread sheet.
it is useed by no clacsz - it just is a date to tell
everyoon ethe last time the sheet was changed.

I would like to automate this date so that it changes

upon
any change in the sheet being made.

If the sheet is just opened and accessed then I need the
date to stay put.



It is a 2 or three sheet workbook - usually two

2 people have access to read write this sheet and the

rest
have read only

Thanks for your time
.

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Automating a date field to change on certain action

Right click on the sheet tab and select view code. Put it there.

--
Regards,
Tom Ogilvy

"todd" wrote in message
...
Hey thank you for the time

I assume this goes in "this work book" or is it in a
module.

T
-----Original Message-----
Quite a commonly asked question.


Use the worksheet's change event to populate the date cell

Private Sub Worksheet_Change(ByVal Target As Range)
Static bUpdating As Boolean

If bUpdating Then
bUpdating = False
Else
bUpdating = True
Range("A1").Value = Format$(Date, "dd-mmm-yy HH:MM")
End If

End Sub


As the change is an event, setting adding the datestamp
will fire the event againg - hence the bolean flags this
and prevents an endless loop.

Change a cell
event fires
boolean is false, so set to true
add the date
event fires
the boolean is true, so reset it
end of second event
end of first event


HTH

Patrick Molloy
Microsoft Excel MVP





-----Original Message-----
I have a date in a cell on a spread sheet.
it is useed by no clacsz - it just is a date to tell
everyoon ethe last time the sheet was changed.

I would like to automate this date so that it changes

upon
any change in the sheet being made.

If the sheet is just opened and accessed then I need the
date to stay put.



It is a 2 or three sheet workbook - usually two

2 people have access to read write this sheet and the

rest
have read only

Thanks for your time
.

.



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
Change format of a date field Sageman Excel Worksheet Functions 7 November 13th 08 09:24 AM
Automating grouping of Excel pivot field [email protected] Excel Discussion (Misc queries) 4 March 6th 07 01:27 AM
Automating grouping of Excel pivot field [email protected] Excel Worksheet Functions 4 March 6th 07 01:27 AM
I can't get a macro action to start from the current field? Paul Keeling Excel Discussion (Misc queries) 1 June 21st 06 02:57 PM
I can't get a macro action to start from the current field? Paul Keeling Excel Discussion (Misc queries) 0 June 21st 06 02:53 PM


All times are GMT +1. The time now is 09:51 AM.

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

About Us

"It's about Microsoft Excel"