PC Review


Reply
Thread Tools Rate Thread

How do I timestamp a cell in excel (I don't know VBA)

 
 
avalonchris
Guest
Posts: n/a
 
      3rd Apr 2009
I need to add a timestamp (mm/dd/yyyy hh:mm:ss AM/PM) in column B1 when a
user enters a value in column A1. The same is true for B2 when a user enters
A2. If a user enters A2 then it should not change B1.

Thoughts? I have found solutions but unable to get them to work (newbie in
excel VBA). I am also using EXCEL 2007.
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      3rd Apr 2009
Take a look at JE McGimpsey's site:
http://www.mcgimpsey.com/excel/timestamp.html

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)

avalonchris wrote:
>
> I need to add a timestamp (mm/dd/yyyy hh:mm:ss AM/PM) in column B1 when a
> user enters a value in column A1. The same is true for B2 when a user enters
> A2. If a user enters A2 then it should not change B1.
>
> Thoughts? I have found solutions but unable to get them to work (newbie in
> excel VBA). I am also using EXCEL 2007.


--

Dave Peterson
 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      3rd Apr 2009
Right-click on the sheet tab and "View Code"

Copy/paste this code into that module.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col A
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
With Target
If .Value <> "" Then
.Offset(0, 1).Value = Format(Now, "mm/dd/yyyy hh:mm:ss AM/PM")
End If
End With
End If
enditall:
Application.EnableEvents = True
End Sub

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP

On Thu, 2 Apr 2009 18:14:01 -0700, avalonchris
<(E-Mail Removed)> wrote:

>I need to add a timestamp (mm/dd/yyyy hh:mm:ss AM/PM) in column B1 when a
>user enters a value in column A1. The same is true for B2 when a user enters
>A2. If a user enters A2 then it should not change B1.
>
>Thoughts? I have found solutions but unable to get them to work (newbie in
>excel VBA). I am also using EXCEL 2007.


 
Reply With Quote
 
Ledigimate
Guest
Posts: n/a
 
      3rd Apr 2009
When you say "column" A1, do you actually mean cell A1, are you referring to
the entire column A? This is important to know in order to suggest the
correct VBA code sample.

"avalonchris" <(E-Mail Removed)> wrote in message
news:AD9C8857-8F0A-4600-9534-(E-Mail Removed)...
>I need to add a timestamp (mm/dd/yyyy hh:mm:ss AM/PM) in column B1 when a
> user enters a value in column A1. The same is true for B2 when a user
> enters
> A2. If a user enters A2 then it should not change B1.
>
> Thoughts? I have found solutions but unable to get them to work (newbie
> in
> excel VBA). I am also using EXCEL 2007.



 
Reply With Quote
 
Ledigimate
Guest
Posts: n/a
 
      3rd Apr 2009
After a re-read of your question, I understood what you meant. The code in
Gord Dibben's reply does the trick.

"Ledigimate" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When you say "column" A1, do you actually mean cell A1, are you referring
> to the entire column A? This is important to know in order to suggest the
> correct VBA code sample.
>
> "avalonchris" <(E-Mail Removed)> wrote in message
> news:AD9C8857-8F0A-4600-9534-(E-Mail Removed)...
>>I need to add a timestamp (mm/dd/yyyy hh:mm:ss AM/PM) in column B1 when a
>> user enters a value in column A1. The same is true for B2 when a user
>> enters
>> A2. If a user enters A2 then it should not change B1.
>>
>> Thoughts? I have found solutions but unable to get them to work (newbie
>> in
>> excel VBA). I am also using EXCEL 2007.

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Timestamp a cell when row is updated. BakerInSpain Microsoft Excel Programming 3 16th Nov 2009 12:36 PM
Is it possible to timestamp a cell? newman Microsoft Excel Discussion 9 27th Jul 2007 12:47 PM
Excel formula timestamp for a data entry of a referenced cell =?Utf-8?B?am1hc2FraQ==?= Microsoft Excel Worksheet Functions 1 3rd Jul 2006 02:19 AM
timestamp a cell Mike Microsoft Excel Discussion 2 12th Feb 2004 12:21 AM
if user changes cell - timestamp cell in next column ed Microsoft Excel Misc 1 1st Aug 2003 06:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:30 PM.