Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 46
Default Name Sheet Tab to Reflect Edit Date

'Hi,

'I got this simple code, I was wondering if anybody here can help me put
the 'value of "_timestamp" (see below) as name of my worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,510
Default Name Sheet Tab to Reflect Edit Date

Hi Gerard,

Set the format "dd mmm yyyy hh_mm_ss" in the code to whatever format you
want. However, you cannot use some characters like a colon (:) in the sheet
name so can't use them in the date/time format.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim dateTemp As Date

ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now()

'Remove the leading = sign from the value and save to date variable
dateTemp = Val(Mid(ActiveWorkbook.Names("_timestamp"), 2))

ActiveSheet.Name = Format(dateTemp, "dd mmm yyyy hh_mm_ss")

End Sub

--
Regards,

OssieMac


"Gerard Sanchez" wrote:

'Hi,

'I got this simple code, I was wondering if anybody here can help me put
the 'value of "_timestamp" (see below) as name of my worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now

End Sub



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,510
Default Name Sheet Tab to Reflect Edit Date

Hi again Gerard,

I had an error in the previous post. It works OK but because you had already
set the scope of the name to ActiveSheet in the previous line of code, I
should not have used ActiveWorkbook in the line that assigns the date to
dateTemp. Use the following corrected code.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim dateTemp As Date

ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now()

'Remove the leading = sign from value and save as date variable
dateTemp = Val(Mid(ActiveSheet.Names("_timestamp"), 2))

ActiveSheet.Name = Format(dateTemp, "dd mmm yyyy hh_mm_ss")

End Sub


--
Regards,

OssieMac


"OssieMac" wrote:

Hi Gerard,

Set the format "dd mmm yyyy hh_mm_ss" in the code to whatever format you
want. However, you cannot use some characters like a colon (:) in the sheet
name so can't use them in the date/time format.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim dateTemp As Date

ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now()

'Remove the leading = sign from the value and save to date variable
dateTemp = Val(Mid(ActiveWorkbook.Names("_timestamp"), 2))

ActiveSheet.Name = Format(dateTemp, "dd mmm yyyy hh_mm_ss")

End Sub

--
Regards,

OssieMac


"Gerard Sanchez" wrote:

'Hi,

'I got this simple code, I was wondering if anybody here can help me put
the 'value of "_timestamp" (see below) as name of my worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now

End Sub



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 46
Default Name Sheet Tab to Reflect Edit Date

It worked!
Thank you OssieMac for helping and taking the time :-)

Cheers!

--gerard


"OssieMac" wrote in message
...
Hi again Gerard,

I had an error in the previous post. It works OK but because you had
already
set the scope of the name to ActiveSheet in the previous line of code, I
should not have used ActiveWorkbook in the line that assigns the date to
dateTemp. Use the following corrected code.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim dateTemp As Date

ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now()

'Remove the leading = sign from value and save as date variable
dateTemp = Val(Mid(ActiveSheet.Names("_timestamp"), 2))

ActiveSheet.Name = Format(dateTemp, "dd mmm yyyy hh_mm_ss")

End Sub


--
Regards,

OssieMac


"OssieMac" wrote:

Hi Gerard,

Set the format "dd mmm yyyy hh_mm_ss" in the code to whatever format you
want. However, you cannot use some characters like a colon (:) in the
sheet
name so can't use them in the date/time format.

Private Sub Worksheet_Change(ByVal Target As Range)

Dim dateTemp As Date

ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now()

'Remove the leading = sign from the value and save to date variable
dateTemp = Val(Mid(ActiveWorkbook.Names("_timestamp"), 2))

ActiveSheet.Name = Format(dateTemp, "dd mmm yyyy hh_mm_ss")

End Sub

--
Regards,

OssieMac


"Gerard Sanchez" wrote:

'Hi,

'I got this simple code, I was wondering if anybody here can help me
put
the 'value of "_timestamp" (see below) as name of my worksheet.


Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Names.Add Name:="_timestamp", RefersTo:=Now

End Sub





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
Edit links when the sheet is protected sly Excel Discussion (Misc queries) 3 September 28th 07 02:48 AM
How do view and edit ALL hyperlinks in a sheet? jrh11 Excel Discussion (Misc queries) 0 September 15th 06 11:46 AM
Selct and edit sheet NNothard Excel Discussion (Misc queries) 2 August 14th 06 05:21 PM
Having footer reflect date of last edit/revision? Pheasant Plucker® Excel Discussion (Misc queries) 1 April 26th 06 06:41 AM
edit Excel spread sheet Judy T New Users to Excel 3 March 24th 05 12:04 AM


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

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"