ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro to make current date remain fixed (https://www.excelbanter.com/excel-programming/414933-macro-make-current-date-remain-fixed.html)

line

macro to make current date remain fixed
 
Hi,
I want to insert a current date into a cell, but then to have that date
remain fixed. Basically, Im using an IF function to create a date in a cell
along the lines of IF(A2801000000000,NOW()). The current date fills the
cell, but then changes the next day because of the internal clock.

Ideas?

[email protected]

macro to make current date remain fixed
 
On Jul 31, 11:41*am, line wrote:
Hi,
I want to insert a current date into a cell, but then to have that date
remain fixed. *Basically, Im using an IF function to create a date in a cell
along the lines of IF(A2801000000000,NOW()). *The current date fills the
cell, but then changes the next day because of the internal clock.

Ideas?


CopyPaste SpecialValues
That will keep it fixed to that date, but it eliminates the formula
for the range you have replaced.

line

macro to make current date remain fixed
 
Thank you sbi, I know about the copy paste special and that's why I'd like to
know if anyone has a macro idea to get around the copy paste special.

" wrote:

On Jul 31, 11:41 am, line wrote:
Hi,
I want to insert a current date into a cell, but then to have that date
remain fixed. Basically, Im using an IF function to create a date in a cell
along the lines of IF(A2801000000000,NOW()). The current date fills the
cell, but then changes the next day because of the internal clock.

Ideas?


CopyPaste SpecialValues
That will keep it fixed to that date, but it eliminates the formula
for the range you have replaced.


[email protected]

macro to make current date remain fixed
 
On Jul 31, 12:34*pm, line wrote:
Thank you sbi, I know about the copy paste special and that's why I'd like to
know if anyone has a macro idea to get around the copy paste special.

" wrote:
On Jul 31, 11:41 am, line wrote:
Hi,
I want to insert a current date into a cell, but then to have that date
remain fixed. *Basically, Im using an IF function to create a date in a cell
along the lines of IF(A2801000000000,NOW()). *The current date fills the
cell, but then changes the next day because of the internal clock.


Ideas?


CopyPaste SpecialValues
That will keep it fixed to that date, but it eliminates the formula
for the range you have replaced.


Do you want the Date to appear in the same column, or can it appear in
another column? If another, then you can capture on the Date column,
if blank, AND if A2801000000000 Then Now
Sub Dater()

Dim MyCell As Range

For Each MyCell In Range("A:A")
If MyCell.Value "5" Then
If MyCell.Offset(0, 1).Value = "" Then
MyCell.Offset(0, 1).Value = Now()
End If
End If
Next

End Sub

That will give you the current date/Time in the next column.

[email protected]

macro to make current date remain fixed
 
On Jul 31, 12:57*pm, wrote:
On Jul 31, 12:34*pm, line wrote:



Thank you sbi, I know about the copy paste special and that's why I'd like to
know if anyone has a macro idea to get around the copy paste special.


" wrote:
On Jul 31, 11:41 am, line wrote:
Hi,
I want to insert a current date into a cell, but then to have that date
remain fixed. *Basically, Im using an IF function to create a date in a cell
along the lines of IF(A2801000000000,NOW()). *The current date fills the
cell, but then changes the next day because of the internal clock.


Ideas?


CopyPaste SpecialValues
That will keep it fixed to that date, but it eliminates the formula
for the range you have replaced.


Do you want the Date to appear in the same column, or can it appear in
another column? If another, then you can capture on the Date column,
if blank, AND if A2801000000000 Then Now
Sub Dater()

Dim MyCell As Range

For Each MyCell In Range("A:A")
* * * If MyCell.Value "5" Then
* * * * * * * * * If MyCell.Offset(0, 1).Value = "" Then
* * * * * * * * * * * * MyCell.Offset(0, 1).Value = Now()
* * * * * * * * * End If
* * * * End If
Next

End Sub

That will give you the current date/Time in the next column.


Just change the line
If MyCell.Value "5" Then

to
If MyCell.Value "801000000000" Then

sammy

macro to make current date remain fixed
 
Hi,

Got this from the help file:

To insert the current date, press CTRL+; (semi-colon).
To insert the current time, press CTRL+SHIFT+; (semi-colon).
to insert the current date and time, press CTRL+; (semi-colon), then press
SPACE, and then press CTRL+SHIFT+; (semi-colon).

Sammy

"line" wrote:

Hi,
I want to insert a current date into a cell, but then to have that date
remain fixed. Basically, Im using an IF function to create a date in a cell
along the lines of IF(A2801000000000,NOW()). The current date fills the
cell, but then changes the next day because of the internal clock.

Ideas?


sammy

macro to make current date remain fixed
 
nevermind...i forgot which group i was in.

"sammy" wrote:

Hi,

Got this from the help file:

To insert the current date, press CTRL+; (semi-colon).
To insert the current time, press CTRL+SHIFT+; (semi-colon).
to insert the current date and time, press CTRL+; (semi-colon), then press
SPACE, and then press CTRL+SHIFT+; (semi-colon).

Sammy

"line" wrote:

Hi,
I want to insert a current date into a cell, but then to have that date
remain fixed. Basically, Im using an IF function to create a date in a cell
along the lines of IF(A2801000000000,NOW()). The current date fills the
cell, but then changes the next day because of the internal clock.

Ideas?



All times are GMT +1. The time now is 01:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com