Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Philip
 
Posts: n/a
Default My Quest with Time!!

Hello Friends

Now this is a very simple concern that I put forth but which seemingly takes
a long time to answer!!

Well, lets look at the table below :

Order Status st Time End Time Time lapsed
112345 A 11:30 11:50 0:20
12456 N 11:55 12:40 0:45

Now, I want the third field(st Time) to show the current time when a user
enters the first field(Order) and field four(End Time) to show the current
time when a user enters the second field(Status) but only for Status 'A'.
Simple!!

Well, if so please help. I used the now() function but all cells keep
changing when a new cell is entered.

Thank you

Philip Jacob
Senior Executive Quality Appraisal
First American Corporation
  #2   Report Post  
Mangesh Yadav
 
Posts: n/a
Default

You need an event code.

Right click on the sheet name tab and go to view code, and enter the
following code:


Private Sub Worksheet_Change(ByVal Target As Range)

if Target.Row = 1 then Exit Sub

If Target.Column = 1 Then
Cells(Target.Row, "D") = Now()
End If

If Target.Column = 2 And Target.Value = "A" Then
Cells(Target.Row, "E") = Now()
End If

End Sub


Assumptions:
Your data starts from cell A1.


Mangesh


"Philip" wrote in message
...
Hello Friends

Now this is a very simple concern that I put forth but which seemingly

takes
a long time to answer!!

Well, lets look at the table below :

Order Status st Time End Time Time lapsed
112345 A 11:30 11:50 0:20
12456 N 11:55 12:40 0:45

Now, I want the third field(st Time) to show the current time when a user
enters the first field(Order) and field four(End Time) to show the current
time when a user enters the second field(Status) but only for Status 'A'.
Simple!!

Well, if so please help. I used the now() function but all cells keep
changing when a new cell is entered.

Thank you

Philip Jacob
Senior Executive Quality Appraisal
First American Corporation



  #3   Report Post  
Paul Sheppard
 
Posts: n/a
Default


Philip Wrote:
Hello Friends

Now this is a very simple concern that I put forth but which seemingly
takes
a long time to answer!!

Well, lets look at the table below :

Order Status st Time End Time Time lapsed
112345 A 11:30 11:50 0:20
12456 N 11:55 12:40 0:45

Now, I want the third field(st Time) to show the current time when a
user
enters the first field(Order) and field four(End Time) to show the
current
time when a user enters the second field(Status) but only for Status
'A'.
Simple!!

Well, if so please help. I used the now() function but all cells keep
changing when a new cell is entered.

Thank you

Philip Jacob
Senior Executive Quality Appraisal
First American Corporation


Hi Philip

Assuming data is in the range A1 to E3 in your example, try this,
adjust the ranges as needed

In the third column enter this formula =IF(A2="","",NOW())
In the fourth column enter this formula =IF(B2="","",NOW())
In the fifth column enter this formula
=IF(A2="","",IF(D2="","",SUM(D2-C2)))


--
Paul Sheppard


------------------------------------------------------------------------
Paul Sheppard's Profile: http://www.excelforum.com/member.php...o&userid=24783
View this thread: http://www.excelforum.com/showthread...hreadid=397122

  #4   Report Post  
Philip
 
Posts: n/a
Default

Mangesh,

Excellent. Thank you very much. Exactly what I was looking for. Works very
well.

I s there a way I can include the code only once for many sheets. And the
target becomes the active sheet.

Thnaks again

Philip Jacob
Senior Executive Quality Appraisal
First American Corporation.

"Mangesh Yadav" wrote:

You need an event code.

Right click on the sheet name tab and go to view code, and enter the
following code:


Private Sub Worksheet_Change(ByVal Target As Range)

if Target.Row = 1 then Exit Sub

If Target.Column = 1 Then
Cells(Target.Row, "D") = Now()
End If

If Target.Column = 2 And Target.Value = "A" Then
Cells(Target.Row, "E") = Now()
End If

End Sub


Assumptions:
Your data starts from cell A1.


Mangesh


"Philip" wrote in message
...
Hello Friends

Now this is a very simple concern that I put forth but which seemingly

takes
a long time to answer!!

Well, lets look at the table below :

Order Status st Time End Time Time lapsed
112345 A 11:30 11:50 0:20
12456 N 11:55 12:40 0:45

Now, I want the third field(st Time) to show the current time when a user
enters the first field(Order) and field four(End Time) to show the current
time when a user enters the second field(Status) but only for Status 'A'.
Simple!!

Well, if so please help. I used the now() function but all cells keep
changing when a new cell is entered.

Thank you

Philip Jacob
Senior Executive Quality Appraisal
First American Corporation




  #5   Report Post  
Mangesh Yadav
 
Posts: n/a
Default

Enter the following code in the standard module

Sub MyMacro(Target As Object)

If Target.Row = 1 Then Exit Sub

If Target.Column = 1 Then
Cells(Target.Row, "D") = Now()
End If

If Target.Column = 2 And Target.Value = "A" Then
Cells(Target.Row, "E") = Now()
End If

End Sub



And for each sheet module enter:
Private Sub Worksheet_Change(ByVal Target As Range)

Call MyMacro(Target)

End Sub



Mangesh



"Philip" wrote in message
...
Mangesh,

Excellent. Thank you very much. Exactly what I was looking for. Works very
well.

I s there a way I can include the code only once for many sheets. And the
target becomes the active sheet.

Thnaks again

Philip Jacob
Senior Executive Quality Appraisal
First American Corporation.

"Mangesh Yadav" wrote:

You need an event code.

Right click on the sheet name tab and go to view code, and enter the
following code:


Private Sub Worksheet_Change(ByVal Target As Range)

if Target.Row = 1 then Exit Sub

If Target.Column = 1 Then
Cells(Target.Row, "D") = Now()
End If

If Target.Column = 2 And Target.Value = "A" Then
Cells(Target.Row, "E") = Now()
End If

End Sub


Assumptions:
Your data starts from cell A1.


Mangesh


"Philip" wrote in message
...
Hello Friends

Now this is a very simple concern that I put forth but which seemingly

takes
a long time to answer!!

Well, lets look at the table below :

Order Status st Time End Time Time lapsed
112345 A 11:30 11:50 0:20
12456 N 11:55 12:40 0:45

Now, I want the third field(st Time) to show the current time when a

user
enters the first field(Order) and field four(End Time) to show the

current
time when a user enters the second field(Status) but only for Status

'A'.
Simple!!

Well, if so please help. I used the now() function but all cells keep
changing when a new cell is entered.

Thank you

Philip Jacob
Senior Executive Quality Appraisal
First American Corporation






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
time math USAOz Excel Worksheet Functions 2 August 14th 05 07:19 AM
Time Sheets smiller3128 New Users to Excel 1 August 4th 05 08:17 PM
time differences in a column 68magnolia71 Excel Worksheet Functions 3 May 9th 05 09:46 PM
Time Sheets Lady Layla Excel Discussion (Misc queries) 1 March 23rd 05 03:22 PM
unmet challenge boris Excel Worksheet Functions 2 March 16th 05 02:13 PM


All times are GMT +1. The time now is 04:54 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"