macro to make current date remain fixed

  • Thread starter Thread starter line
  • Start date Start date
L

line

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(A2>801000000000,NOW()). The current date fills the
cell, but then changes the next day because of the internal clock.

Ideas?
 
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 acell
along the lines of IF(A2>801000000000,NOW()).  The current date fills the
cell, but then changes the next day because of the internal clock.

Ideas?

Copy>Paste Special>Values
That will keep it fixed to that date, but it eliminates the formula
for the range you have replaced.
 
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.
 
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.

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 A2>801000000000 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.
 
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 A2>801000000000 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
 
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
 
nevermind...i forgot which group i was in.

sammy said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top