Auto Date

berg891832

Well-known Member
Joined
May 2, 2002
Messages
509
Is it possible that when I type data into Cell A1, the date will automatically appear next to it in cell B1? I want this down the column.

the date has to be static. I tried this =if(isempty(a1),"",today()). This works but teh date changes everyday to reflect the current date.

Bill
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Right click the sheet tab, select View Code and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 1 Then
    Application.EnableEvents = False
    Target.Offset(0, 1).Value = Date
    Application.EnableEvents = True
End If
End Sub

then close the code window using the X.
 
Upvote 0
I love it when you use the search function and you find exactly what your after.
Mr.Excel just keeps on rickin' IMHO!

I used this code, and since I have absolutely no clue on code or writing code this was super helpful.
My small problem was I needed this funtion to also happen a few cells accross, but getting the code to do that was almost impossible with no knowledge.
I tried a heap of things and eventually when i worked out what was what i came up with this.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Then
Application.EnableEvents = False
Target.Offset(0, 1).Value = Date
Application.EnableEvents = True
End If
If Target.Column = 8 Then
Application.EnableEvents = False
Target.Offset(0, 1).Value = Date
Application.EnableEvents = True
End If
End Sub


Now like I said I knwo nothing about code, I used the code from the OP and then tried cutting and pasting a few ways and bingo.
Now I'm not sure if this is how you should add the code, but it works for me.
So thanks VoG II for the original code, cheers mate.
:D
 
Upvote 0
So thanks VoG II for the original code, cheers mate.
:D

You are welcome :)

Your code could actually be shortened somewhat:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 3 Or Target.Column = 8 Then
    Application.EnableEvents = False
    Target.Offset(0, 1).Value = Date
    Application.EnableEvents = True
End If
End Sub
 
Upvote 0
Well thanks again VoG, you've been a great help, you may have started my coding adventure.
Will have to get me some books I think.
Thanks mate.
:D
 
Upvote 0
How would one modify this code to include the current (static) time as well as date? I type "time" in a couple of ways but it didn't like it. I know nothing of codes. Thanks for any help.
 
Upvote 0
Thanks Norie, that worked, just what I was looking for. I found another way in another thread: Date + Time. Both seem to work the same; I'm going to use Now because it's simpler. Can anyone comment on the difference between the two? Neither date/time stamp change when I close the file and reopen it,,, so it's acting like a static date/time, they only change(update) on an "enter" from column 1.
 
Upvote 0
Don't you want the date/time to be static?
 
Upvote 0

Forum statistics

Threads
1,217,040
Messages
6,134,155
Members
449,861
Latest member
DMJHohl

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top