View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default referencing another sheet

Hi James,

Try this

Sub LastModified()
Dim datLastModified As Date
Dim datToday As Date
Dim intLastCell As Integer
Dim sSheet As String

datToday = Date
Application.ScreenUpdating = False

Worksheets("Log").Select
With Range("A1").SpecialCells(xlLastCell)
datLastModified = .Value
sSheet = Format(datLastModified, "mmmyyyy")
.Offset(1, 0) = datToday
End With

Application.ScreenUpdating = True

MsgBox "Last modified on: " & datLastModified, vbOKOnly, "Last Modified"

Worksheets(sSheet).Activate

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"James" wrote in message
ink.net...
Hello NG,
can someone please help me with problem in regards to referencing another
worksheet?
I have a worksheet called "log" which keeps track of the date the last

time
the workbook was modified.
I also have many worksheets for each month of the years, (i.e. jan2004,
feb2004, mar2004...).
What I would like to do is display a message showing the date the last

time
the workbook is modified.
I can get everything to work but I always end up on the log sheet, how can

I
sat on the current month's page and reference the Log sheet?
Any suggestions would be greatly appreciated.
Thanks
James

This works============================================= =======

Sub LastModified()

Dim datLastModified As Date
Dim datToday As Date
Dim intLastCell As Integer

datToday = Date
Application.ScreenUpdating = False

Worksheets("Log").Select
Range("=Log!A1").Select
ActiveCell.SpecialCells(xlLastCell).Select
datLastModified = ActiveCell.Value
ActiveCell.Offset(1, 0) = datToday

Application.ScreenUpdating = True

MsgBox "Last modified on: " & datLastModified, vbOKOnly, "Last Modified"

End Sub