#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 62
Default Date and time

Hi all,

I need somebody to help me find the appropriate equation to do the
following:
When an employee selects his name from the drop down list in the cell
F1,today's date appears in A1 and time() in B2.
On the next day if an employee wants to change his name in the cell F1 and
selects another name,the date and time written in A1 and B2 DON'T change.
In other words,when users enter their names in F1 ,if A1 Is Null then
A1=today()
and if B1 Is Null then B1=NOW().
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,886
Default Date and time

Hi

You could use a modification of the code that Bob Philips provided for
you


Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "F1"

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then

If Range("A1") = "" Then
Range("A1") = Date
End If
If Range("B1") = "" Then
Range("B1") = Format(Now, "hh:mm")
End If
End If

ws_exit:
Application.EnableEvents = True
End Sub



--
Regards

Roger Govier


"Pietro" wrote in message
...
Hi all,

I need somebody to help me find the appropriate equation to do the
following:
When an employee selects his name from the drop down list in the cell
F1,today's date appears in A1 and time() in B2.
On the next day if an employee wants to change his name in the cell F1
and
selects another name,the date and time written in A1 and B2 DON'T
change.
In other words,when users enter their names in F1 ,if A1 Is Null then
A1=today()
and if B1 Is Null then B1=NOW().



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
Calculating days & time left from start date/time to end date/time marie Excel Worksheet Functions 7 December 7th 05 03:36 PM
Combined date time cell to separate date & time components Mark Ada Excel Discussion (Misc queries) 1 December 2nd 04 03:48 AM
Combined date time cell to separate date & time components Mark Ada Excel Discussion (Misc queries) 1 December 2nd 04 01:07 AM
Combined date time cell to separate date & time components Mark Ada Excel Discussion (Misc queries) 1 December 2nd 04 01:07 AM
Combined date time cell to separate date & time components Mark Ada Excel Worksheet Functions 1 December 2nd 04 01:04 AM


All times are GMT +1. The time now is 11:37 AM.

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

About Us

"It's about Microsoft Excel"