Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default sheet update date

I have a excel workbook with many sheets and in my master sheet i hv all the
sheet names in one column, i would like to have macro code ,so that if
anybody type any comments on any sheets the date need to be appeared on my
master sheet next to sheet name column.

Example
Master Sheet:
sheetname
sheet1
sheet2
if somebody open the excel file and update the comments on sheet2 and the
file is saved and closed.

when i look into my master file, the comments updated date should appear
next to column of sheet names
Master Sheet:
sheetname comment Date
sheet1
sheet2 May 27th 2009 11:15pm
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default sheet update date

use the code page behind ThisWorkbook, and add this code:

Option Explicit
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim rw As Long
Dim indexlist As Range
If Sh.Name = "Master Sheet" Then Exit Sub
Set indexlist = Worksheets("Master Sheet").Range("A1:A100")
On Error Resume Next
rw = Application.WorksheetFunction.Match(Sh.Name, indexlist, False)
If Err.Number < 0 Then
Err.Clear
Else
Worksheets("Master Sheet").Range("A1").Offset(rw - 1, 1) = Now
End If
End Sub



"Ranjith Kurian" wrote in message
...
I have a excel workbook with many sheets and in my master sheet i hv all
the
sheet names in one column, i would like to have macro code ,so that if
anybody type any comments on any sheets the date need to be appeared on my
master sheet next to sheet name column.

Example
Master Sheet:
sheetname
sheet1
sheet2
if somebody open the excel file and update the comments on sheet2 and the
file is saved and closed.

when i look into my master file, the comments updated date should appear
next to column of sheet names
Master Sheet:
sheetname comment Date
sheet1
sheet2 May 27th 2009 11:15pm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default sheet update date

Give this workbook event code a try...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim C As Range
Set C = Worksheets("Master Sheet").Columns("A").Find(Sh.Name)
If Not C Is Nothing Then
C.Offset(, 1).Value = Now
End If
End Sub

To install this event code, right click the XL icon immediately to the left
of the File item on Excel's menu bar, select View Code from the popup menu
that appeared, and then copy/paste the above code into the code window that
opened up.

Note that the above code assumes your sheet names are located in Column A
and that the Master Sheet's name does *not* appear anywhere in Column A...
it was unclear from your post whether the "Master Sheet:" designation were
just identifying the sheet or whether it was actually part of your header.
IF the Master Sheet's name *does* appear in the header (assumed to be
located in Row 1), then you can use this variation of the code instead...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim C As Range
Set C = Worksheets("Master Sheet").Columns("A").Find(Sh.Name)
If Not C Is Nothing Then
If C.Row 1 Then C.Offset(, 1).Value = Date
End If
End Sub

--
Rick (MVP - Excel)


"Ranjith Kurian" wrote in message
...
I have a excel workbook with many sheets and in my master sheet i hv all
the
sheet names in one column, i would like to have macro code ,so that if
anybody type any comments on any sheets the date need to be appeared on my
master sheet next to sheet name column.

Example
Master Sheet:
sheetname
sheet1
sheet2
if somebody open the excel file and update the comments on sheet2 and the
file is saved and closed.

when i look into my master file, the comments updated date should appear
next to column of sheet names
Master Sheet:
sheetname comment Date
sheet1
sheet2 May 27th 2009 11:15pm


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default sheet update date

I guess to protect against the possibility of one of your sheet names being
part of another sheet's name, we should restrict the Find operation to the
cell's entire content. Change the Set statement in whichever event code
procedure you used to this...

Set C = Worksheets("Master Sheet").Columns("A"). _
Find(Sh.Name, LookAt:=xlWhole)

--
Rick (MVP - Excel)


"Rick Rothstein" wrote in message
...
Give this workbook event code a try...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Dim C As Range
Set C = Worksheets("Master Sheet").Columns("A").Find(Sh.Name)
If Not C Is Nothing Then
C.Offset(, 1).Value = Now
End If
End Sub

To install this event code, right click the XL icon immediately to the
left of the File item on Excel's menu bar, select View Code from the popup
menu that appeared, and then copy/paste the above code into the code
window that opened up.

Note that the above code assumes your sheet names are located in Column A
and that the Master Sheet's name does *not* appear anywhere in Column A...
it was unclear from your post whether the "Master Sheet:" designation were
just identifying the sheet or whether it was actually part of your header.
IF the Master Sheet's name *does* appear in the header (assumed to be
located in Row 1), then you can use this variation of the code instead...

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
Dim C As Range
Set C = Worksheets("Master Sheet").Columns("A").Find(Sh.Name)
If Not C Is Nothing Then
If C.Row 1 Then C.Offset(, 1).Value = Date
End If
End Sub

--
Rick (MVP - Excel)


"Ranjith Kurian" wrote in
message ...
I have a excel workbook with many sheets and in my master sheet i hv all
the
sheet names in one column, i would like to have macro code ,so that if
anybody type any comments on any sheets the date need to be appeared on
my
master sheet next to sheet name column.

Example
Master Sheet:
sheetname
sheet1
sheet2
if somebody open the excel file and update the comments on sheet2 and the
file is saved and closed.

when i look into my master file, the comments updated date should appear
next to column of sheet names
Master Sheet:
sheetname comment Date
sheet1
sheet2 May 27th 2009 11:15pm



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
Update date every two weeks when a sheet is opened [email protected] Excel Programming 4 April 24th 09 11:14 AM
Automatically update a cell with a date based on anther cells date GPR GUY Excel Discussion (Misc queries) 2 November 3rd 08 03:57 PM
Display a update date on a sheet for a shared excel workbook jumpa311 Excel Worksheet Functions 1 February 20th 08 08:19 PM
How to update a cell if a specific date is included in a date rang mgavidia Setting up and Configuration of Excel 2 October 8th 05 12:53 AM
Date update on data update Chris Thompson Excel Programming 3 August 22nd 03 06:40 PM


All times are GMT +1. The time now is 03:34 PM.

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

About Us

"It's about Microsoft Excel"