Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Creating non-volatile Date

Hi All
I have a requirement to, from within VBA, store the
current date into a worksheet.cell. But for that date to
be non-volatile.

If I use the system date functions then this will always
change, after the worksheet is reloaded. What is the best
approach to overcome this?

Cheers
Nigel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default Creating non-volatile Date

Hi Nigel

Sub DateMe()
Sheets(1).Range("C14").Value = Date
End Sub

HTH. best wishes Harald

"Nigel" skrev i melding
...
Hi All
I have a requirement to, from within VBA, store the
current date into a worksheet.cell. But for that date to
be non-volatile.

If I use the system date functions then this will always
change, after the worksheet is reloaded. What is the best
approach to overcome this?

Cheers
Nigel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Creating non-volatile Date

Nigel wrote:
Hi All
I have a requirement to, from within VBA, store the
current date into a worksheet.cell. But for that date to
be non-volatile.

If I use the system date functions then this will always
change, after the worksheet is reloaded. What is the best
approach to overcome this?

Cheers
Nigel


I suspect what you want to do is write a macro to
(1) copy the cell containing the date
and
(2) paste the contents of the cell back into the cell using PASTE
SPECIAL / VALUE

You can obtain the appropriate code by merely recording a macro of the
operation being performed.
  #4   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Creating non-volatile Date

If this is going to be used in a Workbook_Open event macro or called
automatically from another procedure, wrap it in an IF. That way, if it's
already been done once, it won't change unexpectedly.
' Assuming A1 has the non-volatile date,
If Range("A1") < "" Then
' code to capture date
End If

Ed

"windsurferLA" wrote in message
...
Nigel wrote:
Hi All
I have a requirement to, from within VBA, store the
current date into a worksheet.cell. But for that date to
be non-volatile.

If I use the system date functions then this will always
change, after the worksheet is reloaded. What is the best
approach to overcome this?

Cheers
Nigel


I suspect what you want to do is write a macro to
(1) copy the cell containing the date
and
(2) paste the contents of the cell back into the cell using PASTE
SPECIAL / VALUE

You can obtain the appropriate code by merely recording a macro of the
operation being performed.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Creating non-volatile Date


Nigel wrote:
Hi All
I have a requirement to, from within VBA, store the
current date into a worksheet.cell. But for that date to
be non-volatile.

If I use the system date functions then this will always
change, after the worksheet is reloaded. What is the best
approach to overcome this?

Cheers
Nigel


Hi -

This puts the both the data and the time in cell A1:

ThisWorkbook.Sheets("NameOfSheet").Cells(A1).Value = Now()

where you replace "NameOfSheet" with the worksheet name that you
actually are using. Also adjust the Cells(A1) to the proper cell
reference that you need.

By using the attribute ".Value" of the function "Now()" in ".Cells(A1)"
of the worksheet "ThisWorkbook.Sheets("NameOfSheet")" you get the
nonvolatile results of the function "Now()". It's a great way of
timestamping any and all workbooks and worksheets...

Hope this helps

John

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
volatile v non-volatile CJ Excel Discussion (Misc queries) 4 February 12th 10 12:16 PM
Volatile Symbol DOUG Excel Discussion (Misc queries) 4 April 21st 09 03:28 PM
How do I make DATE non-volatile? MichaelRobert Excel Worksheet Functions 3 June 21st 08 04:23 PM
INDEX - volatile or not? T. Valko Excel Worksheet Functions 8 February 23rd 07 07:24 PM
Detect any Volatile UDF Sandy V[_4_] Excel Programming 4 October 23rd 03 01:26 PM


All times are GMT +1. The time now is 02:13 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"