How input today's date and keep that date

T

tjsmags

I need to input today's date in my worksheet. But, I want that date to stay
THAT date when I open it up a month from now...I don't want it to change to
today's date.

For example, I'm working on my worksheet today and have a cell that input's
today's date next to the data I have. So, it inputs 12/30/07. When I open
this worksheet a month from now I do NOT want it to change that cell to show
today's date (i.e. 01/30/08)...I want it to keep 12/30/07.

How do I do that?
 
W

Wigi

Ctrl+; works for me, but depending on the organisation of your keyboard, it
might be different.
 
G

Gord Dibben

Insert the date using CTRL + semi-colon(;)

Will remain static.

Or use sheet event code to enter the static date when you enter data or edit a
cell in Column A

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A date is placed in B
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Excel.Range("A" & n).Value <> "" Then
Excel.Range("B" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that sheet module. Alt + q to return to Excel window.


Gord Dibben MS Excel MVP
 

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

Top