Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Current time Current date.

Paul,

Thanks for the help and the code worked fine. Now, I just need to tweak it a
bit. I thought I could figure it out on my own but I am at a loss. So, here
is specifically what I need to do. At cell C9, I will add a line of text and
hit enter. I need the current date to be entered into A9 and the time to be
entered into B9. A few moments later I will add a line of text into C10, and
I need the exact date to be filled into cell A10 and the time into B10, and
so on and so on, and so. But I only need this to start on line 9 and down
from there. Hopefully, you can help me.

TIA,

yo beee

"Paul B" wrote in message
...
yo beee, right click your worksheet tab and view code, paste this in the
window that opens

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'will put the time in column A and the date in column C
' date and time in column D when you put data in column B
If Target.Count 1 Then Exit Sub
If Target.Column = 2 Then
Target.Offset(0, -1).Value = Time()
Target.Offset(0, 1).Value = Date
Target.Offset(0, 2).Value = Now
End If
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
"yo beee" wrote in message
...
TIA to anyone who can help with this macro. I need a macro in EXCEL to

enter
the current time in a cell when another cell has data entered. For

instance,
if I add a number in cel B1 and select the enter button, cell A1 will

show
the computer's current time in which that data was entered. I also need

a
macro to do the very same thing with the date.
Thanks again,
yo beee






  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Current time Current date.

Hi Yo Beee

Try:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If .Column = 3 And .Row 8 Then
.Offset(0, -1).Value = Time()
.Offset(0, -2).Value = Date
End If
End With
End Sub


---
Regards,
Norman


"yo beee" wrote in message
...
Paul,

Thanks for the help and the code worked fine. Now, I just need to tweak it

a
bit. I thought I could figure it out on my own but I am at a loss. So,

here
is specifically what I need to do. At cell C9, I will add a line of text

and
hit enter. I need the current date to be entered into A9 and the time to

be
entered into B9. A few moments later I will add a line of text into C10,

and
I need the exact date to be filled into cell A10 and the time into B10,

and
so on and so on, and so. But I only need this to start on line 9 and down
from there. Hopefully, you can help me.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Current time Current date.

See

http://www.mcgimpsey.com/excel/timestamp.html

You could use something like:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If Not Intersect(Range("C:C"), .Cells) Is Nothing Then
Application.EnableEvents = False
With .Offset(0, -2).Resize(1, 2)
If IsEmpty(Target.Value) Then
.ClearContents
Else
.Item(1).NumberFormat = "dd mmm yyyy"
.Item(1).Value = Date
.Item(2).NumberFormat = "hh:mm:ss"
.Item(2).Value = Time
End If
End With
Application.EnableEvents = True
End If
End With
End Sub



In article ,
"yo beee" wrote:

Paul,

Thanks for the help and the code worked fine. Now, I just need to tweak it a
bit. I thought I could figure it out on my own but I am at a loss. So, here
is specifically what I need to do. At cell C9, I will add a line of text and
hit enter. I need the current date to be entered into A9 and the time to be
entered into B9. A few moments later I will add a line of text into C10, and
I need the exact date to be filled into cell A10 and the time into B10, and
so on and so on, and so. But I only need this to start on line 9 and down
from there. Hopefully, you can help me.

TIA,

yo beee

"Paul B" wrote in message
...
yo beee, right click your worksheet tab and view code, paste this in the
window that opens

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'will put the time in column A and the date in column C
' date and time in column D when you put data in column B
If Target.Count 1 Then Exit Sub
If Target.Column = 2 Then
Target.Offset(0, -1).Value = Time()
Target.Offset(0, 1).Value = Date
Target.Offset(0, 2).Value = Now
End If
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 97
** remove news from my email address to reply by email **
"yo beee" wrote in message
...
TIA to anyone who can help with this macro. I need a macro in EXCEL to

enter
the current time in a cell when another cell has data entered. For

instance,
if I add a number in cel B1 and select the enter button, cell A1 will

show
the computer's current time in which that data was entered. I also need

a
macro to do the very same thing with the date.
Thanks again,
yo beee




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Current time Current date.

It worked like a charm. Thanks a mil'. Genius, you are!!! Kind, as well, to
help someone out. It is much appreciated.
yo beee
"Norman Jones" wrote in message
...
Hi Yo Beee

Try:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count 1 Then Exit Sub
If .Column = 3 And .Row 8 Then
.Offset(0, -1).Value = Time()
.Offset(0, -2).Value = Date
End If
End With
End Sub


---
Regards,
Norman


"yo beee" wrote in message
...
Paul,

Thanks for the help and the code worked fine. Now, I just need to tweak

it
a
bit. I thought I could figure it out on my own but I am at a loss. So,

here
is specifically what I need to do. At cell C9, I will add a line of text

and
hit enter. I need the current date to be entered into A9 and the time to

be
entered into B9. A few moments later I will add a line of text into C10,

and
I need the exact date to be filled into cell A10 and the time into B10,

and
so on and so on, and so. But I only need this to start on line 9 and

down
from there. Hopefully, you can help me.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Current date and time for different log entries SBO Refiner Excel Discussion (Misc queries) 4 October 18th 07 03:57 PM
Having the current time inserted w/o updating the current time sherobot Excel Worksheet Functions 2 October 2nd 06 05:05 PM
Current date and time when different cell = X Workaholic Excel Worksheet Functions 3 August 13th 06 12:49 AM
How to show current date and time vsr_kmb New Users to Excel 3 March 28th 06 04:09 PM
Can I automatically enter the current date or current time into a Ben New Users to Excel 7 October 19th 05 03:38 PM


All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"