Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
rvs rvs is offline
external usenet poster
 
Posts: 8
Default Time/Date Stamp

Here's my dilemma...

I have 37 different worksheets (one for each major principal in my company)
that are to be updated on a semi-regular basis. I would like for each of
these worksheets to have its own time/date stamp that automatically updates
itself to the current date and time whenever a change is made on the
worksheet. The time/date stamp on one sheet must be independent of the
time/date stamps on all other sheets. In other words, when the time and date
is updated on one sheet none of the other time/date stamps on the other
sheets change unless they are modified as well. I have tried using
SendKeys...I thought I had something, but it seemed too complicated to get it
to work. And I've also tried using the Worksheet_Change event...I've been
tinkering with this code:

Private Sub Worksheet_Change(ByVal Target As Range)

'THIS SUB UPDATES THE DATE/TIME STAMP WHENEVER A CHANGE IS MADE TO A
PRINCIPAL'S SHEET
'Update "Date" cell
Dim Cell As Range
For Each Cell In Target
With Cell
If .Column = Range("B:B").Column Then
Cells(.Row, "F").Value = Int(now)
End If
End With
Next Cell

End Sub

Can someone please advise? Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
rvs rvs is offline
external usenet poster
 
Posts: 8
Default Time/Date Stamp

Thanks for responding!

Each sheet is labled with the last name of each principal in alpabetical
order. Let's look at the first four (for the sake of simplicity): Brunner,
Doak, Gilbert, Gillaspie

When something is changed on Doak's sheet, then the time/date on that sheet
ONLY should update. None of the others should change. What can you tell me
about this?

"Rick Rothstein" wrote:

I think this worksheet code will do what you want...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Column = 2 Then Target.Offset(0, 4).Value = Now
End Sub

Put the code in the ThisWorkbook code window, **not** in any Worksheet's
code window (and you can remove you attempted code from each worksheet's
code module as the above code (if placed in the ThisWorkbook code window)
will handle all sheets in the workbook. If you have other worksheets in the
workbook, then you will need to use the Sh argument to test if the code
should be run or not (I would need to see your sheet names, or at least the
principal's worksheets naming scheme, in order to show you some filtering
code).

--
Rick (MVP - Excel)


"RVS" wrote in message
...
Here's my dilemma...

I have 37 different worksheets (one for each major principal in my
company)
that are to be updated on a semi-regular basis. I would like for each of
these worksheets to have its own time/date stamp that automatically
updates
itself to the current date and time whenever a change is made on the
worksheet. The time/date stamp on one sheet must be independent of the
time/date stamps on all other sheets. In other words, when the time and
date
is updated on one sheet none of the other time/date stamps on the other
sheets change unless they are modified as well. I have tried using
SendKeys...I thought I had something, but it seemed too complicated to get
it
to work. And I've also tried using the Worksheet_Change event...I've been
tinkering with this code:

Private Sub Worksheet_Change(ByVal Target As Range)

'THIS SUB UPDATES THE DATE/TIME STAMP WHENEVER A CHANGE IS MADE TO A
PRINCIPAL'S SHEET
'Update "Date" cell
Dim Cell As Range
For Each Cell In Target
With Cell
If .Column = Range("B:B").Column Then
Cells(.Row, "F").Value = Int(now)
End If
End With
Next Cell

End Sub

Can someone please advise? Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Time/Date Stamp

The code I gave will do what you want (change something on a worksheet and
the date will be placed on that line on that worksheet only)... however,
what I was trying to tell you is that, as written, the code will do that for
**all** worksheets in the workbook. So, if you have other worksheets besides
those for your principals (a summary sheet for example), those would get
dates placed on them also whenever a physical change is made to them. This
is what I meant when I said you might have to filter on the Sh argument in
order to make the code apply only to your principal's worksheets.

--
Rick (MVP - Excel)


"RVS" wrote in message
...
Thanks for responding!

Each sheet is labled with the last name of each principal in alpabetical
order. Let's look at the first four (for the sake of simplicity): Brunner,
Doak, Gilbert, Gillaspie

When something is changed on Doak's sheet, then the time/date on that
sheet
ONLY should update. None of the others should change. What can you tell me
about this?

"Rick Rothstein" wrote:

I think this worksheet code will do what you want...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Column = 2 Then Target.Offset(0, 4).Value = Now
End Sub

Put the code in the ThisWorkbook code window, **not** in any Worksheet's
code window (and you can remove you attempted code from each worksheet's
code module as the above code (if placed in the ThisWorkbook code window)
will handle all sheets in the workbook. If you have other worksheets in
the
workbook, then you will need to use the Sh argument to test if the code
should be run or not (I would need to see your sheet names, or at least
the
principal's worksheets naming scheme, in order to show you some filtering
code).

--
Rick (MVP - Excel)


"RVS" wrote in message
...
Here's my dilemma...

I have 37 different worksheets (one for each major principal in my
company)
that are to be updated on a semi-regular basis. I would like for each
of
these worksheets to have its own time/date stamp that automatically
updates
itself to the current date and time whenever a change is made on the
worksheet. The time/date stamp on one sheet must be independent of the
time/date stamps on all other sheets. In other words, when the time and
date
is updated on one sheet none of the other time/date stamps on the other
sheets change unless they are modified as well. I have tried using
SendKeys...I thought I had something, but it seemed too complicated to
get
it
to work. And I've also tried using the Worksheet_Change event...I've
been
tinkering with this code:

Private Sub Worksheet_Change(ByVal Target As Range)

'THIS SUB UPDATES THE DATE/TIME STAMP WHENEVER A CHANGE IS MADE TO A
PRINCIPAL'S SHEET
'Update "Date" cell
Dim Cell As Range
For Each Cell In Target
With Cell
If .Column = Range("B:B").Column Then
Cells(.Row, "F").Value = Int(now)
End If
End With
Next Cell

End Sub

Can someone please advise? Thanks!




  #4   Report Post  
Posted to microsoft.public.excel.programming
rvs rvs is offline
external usenet poster
 
Posts: 8
Default Time/Date Stamp

I got it! Thanks for your help!

"Rick Rothstein" wrote:

The code I gave will do what you want (change something on a worksheet and
the date will be placed on that line on that worksheet only)... however,
what I was trying to tell you is that, as written, the code will do that for
**all** worksheets in the workbook. So, if you have other worksheets besides
those for your principals (a summary sheet for example), those would get
dates placed on them also whenever a physical change is made to them. This
is what I meant when I said you might have to filter on the Sh argument in
order to make the code apply only to your principal's worksheets.

--
Rick (MVP - Excel)


"RVS" wrote in message
...
Thanks for responding!

Each sheet is labled with the last name of each principal in alpabetical
order. Let's look at the first four (for the sake of simplicity): Brunner,
Doak, Gilbert, Gillaspie

When something is changed on Doak's sheet, then the time/date on that
sheet
ONLY should update. None of the others should change. What can you tell me
about this?

"Rick Rothstein" wrote:

I think this worksheet code will do what you want...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Target.Column = 2 Then Target.Offset(0, 4).Value = Now
End Sub

Put the code in the ThisWorkbook code window, **not** in any Worksheet's
code window (and you can remove you attempted code from each worksheet's
code module as the above code (if placed in the ThisWorkbook code window)
will handle all sheets in the workbook. If you have other worksheets in
the
workbook, then you will need to use the Sh argument to test if the code
should be run or not (I would need to see your sheet names, or at least
the
principal's worksheets naming scheme, in order to show you some filtering
code).

--
Rick (MVP - Excel)


"RVS" wrote in message
...
Here's my dilemma...

I have 37 different worksheets (one for each major principal in my
company)
that are to be updated on a semi-regular basis. I would like for each
of
these worksheets to have its own time/date stamp that automatically
updates
itself to the current date and time whenever a change is made on the
worksheet. The time/date stamp on one sheet must be independent of the
time/date stamps on all other sheets. In other words, when the time and
date
is updated on one sheet none of the other time/date stamps on the other
sheets change unless they are modified as well. I have tried using
SendKeys...I thought I had something, but it seemed too complicated to
get
it
to work. And I've also tried using the Worksheet_Change event...I've
been
tinkering with this code:

Private Sub Worksheet_Change(ByVal Target As Range)

'THIS SUB UPDATES THE DATE/TIME STAMP WHENEVER A CHANGE IS MADE TO A
PRINCIPAL'S SHEET
'Update "Date" cell
Dim Cell As Range
For Each Cell In Target
With Cell
If .Column = Range("B:B").Column Then
Cells(.Row, "F").Value = Int(now)
End If
End With
Next Cell

End Sub

Can someone please advise? Thanks!





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
Date-time stamp Daniel Excel Discussion (Misc queries) 3 September 7th 09 10:58 AM
Time/Date Stamp Rick Rothstein Excel Programming 0 June 17th 09 07:19 PM
Comparing 2 files on date/time stamp, and based time difference do a subroutine [email protected] Excel Programming 1 September 28th 07 03:53 AM
Date-Time Stamp [email protected] Excel Discussion (Misc queries) 1 September 27th 06 02:37 PM
Date/time Stamp? Bowes813[_3_] Excel Programming 7 June 3rd 05 08:10 AM


All times are GMT +1. The time now is 10:57 PM.

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"