Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 12
Default Date and time keep disappearing

Hello,

I am trying to capture a date stamp in a cell when a certain option has
been selected from a drop down menu. After searching on this forum i
made use of

Function DateAndTime()
DateAndTime = Now
End Function

Essentially I have 2 options in my drop down list. "On Going" and
"Complete"

I have 2 further columns labelled Start Time and Finish Time. I am
trying to capture a date stamp in each column using this formula in
column f

=IF(E3="On Going",DateAndTime(),"")

and this formula in column g

=IF(E3="Complete",DateAndTime(),"")

when I select "On Going" from the drop down list the time is captured
in column f perfectly. However when I select "Complete" it captures
the time in column g but nulls the time previously captured in column f
(when "On Going" was selected) as I have changed the value from the
drop down list. Is there anyway that I can ensure the value captured
in Column f stays?

thanks in advance for any help.

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,440
Default Date and time keep disappearing

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


--
Kind regards,

Niek Otten
Microsoft MVP - Excel

wrote in message ups.com...
| Hello,
|
| I am trying to capture a date stamp in a cell when a certain option has
| been selected from a drop down menu. After searching on this forum i
| made use of
|
| Function DateAndTime()
| DateAndTime = Now
| End Function
|
| Essentially I have 2 options in my drop down list. "On Going" and
| "Complete"
|
| I have 2 further columns labelled Start Time and Finish Time. I am
| trying to capture a date stamp in each column using this formula in
| column f
|
| =IF(E3="On Going",DateAndTime(),"")
|
| and this formula in column g
|
| =IF(E3="Complete",DateAndTime(),"")
|
| when I select "On Going" from the drop down list the time is captured
| in column f perfectly. However when I select "Complete" it captures
| the time in column g but nulls the time previously captured in column f
| (when "On Going" was selected) as I have changed the value from the
| drop down list. Is there anyway that I can ensure the value captured
| in Column f stays?
|
| thanks in advance for any help.
|


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Date and time keep disappearing

The value in F is not "null", it just looks blank because of the "".

The actual value in F is FALSE because you have change from "ongoing" to
"complete"

Using your DateAndTime Function produces this.

You may be better off with event code that produces a static date and time in
the cells of F and G

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 5 Then
n = Target.Row
If Excel.Range("E" & n).Value = "on going" Then
Target.Offset(0, 1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
ElseIf Excel.Range("E" & n).Value = "complete" Then
Target.Offset(0, 2).Value = Format(Now, "dd mmm yyyy h:mm:ss")
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 the code into that sheet module.


Gord Dibben MS Excel MVP

On 4 Dec 2006 08:27:37 -0800, wrote:

Hello,

I am trying to capture a date stamp in a cell when a certain option has
been selected from a drop down menu. After searching on this forum i
made use of

Function DateAndTime()
DateAndTime = Now
End Function

Essentially I have 2 options in my drop down list. "On Going" and
"Complete"

I have 2 further columns labelled Start Time and Finish Time. I am
trying to capture a date stamp in each column using this formula in
column f

=IF(E3="On Going",DateAndTime(),"")

and this formula in column g

=IF(E3="Complete",DateAndTime(),"")

when I select "On Going" from the drop down list the time is captured
in column f perfectly. However when I select "Complete" it captures
the time in column g but nulls the time previously captured in column f
(when "On Going" was selected) as I have changed the value from the
drop down list. Is there anyway that I can ensure the value captured
in Column f stays?

thanks in advance for any help.


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
Combine Date & Time Cells KrunoG Excel Discussion (Misc queries) 0 January 31st 06 08:08 PM
How to calculate Date & Time differences robs Excel Worksheet Functions 2 October 4th 05 04:22 PM
Using VLOOKUP with a Date and Time Charles Excel Discussion (Misc queries) 4 September 20th 05 06:38 PM
How do I calculate if a date is in a certain time frame? Pe66les Excel Worksheet Functions 19 August 27th 05 11:07 PM
Imported Date & Time format with calcs. managed in excel from imrp Todd F. Excel Worksheet Functions 0 July 8th 05 09:03 PM


All times are GMT +1. The time now is 10:32 AM.

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"