A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Time Stamp



 
 
Thread Tools Display Modes
  #1  
Old May 5th, 2010, 03:35 AM posted to microsoft.public.excel.misc
Ken
external usenet poster
 
Posts: 954
Default Time Stamp

I have a dynamic stock quote in cell "B2" ... in cell "C2" I want to record
the exact time that the stock price FIRST reachs a certain price. How do I
have this cell record this exact time only the first time the stock is at
this price and not change it later?
--
Ken
  #2  
Old May 5th, 2010, 04:00 AM posted to microsoft.public.excel.misc
ozgrid.com
external usenet poster
 
Posts: 328
Default Time Stamp

Right click on the Sheet and choose View Code. In here paste


Private Sub Worksheet_Calculate()
If Range("B2") = 100 Then Range("C2") = Now
End Sub


--
Regards
Dave Hawley
www.ozgrid.com
"Ken" wrote in message
...
I have a dynamic stock quote in cell "B2" ... in cell "C2" I want to record
the exact time that the stock price FIRST reachs a certain price. How do I
have this cell record this exact time only the first time the stock is at
this price and not change it later?
--
Ken


  #3  
Old May 5th, 2010, 01:15 PM posted to microsoft.public.excel.misc
Dave Peterson
external usenet poster
 
Posts: 19,791
Default Time Stamp

I'm not sure what dynamic means in this case, but if it's based on a formula,
you could use something like this worksheet event procedu

Option Explicit
Private Sub Worksheet_Calculate()

Dim myRngToCheck As Range
Dim myCell As Range
Dim myLimit As Double

Set myRngToCheck = Me.Range("B2")

myLimit = 100

Application.EnableEvents = False
For Each myCell In myRngToCheck.Cells
If myCell.Value2 myLimit Then
If IsEmpty(myCell.Offset(0, 1).Value) Then
With myCell.Offset(0, 1)
.NumberFormat = "mmm dd, yyyy hh:mm:ss"
.Value = Now
End With
End If
End If
Next myCell
Application.EnableEvents = True

End Sub

If you want to try this, rightclick on the worksheet tab that should have this
procedure. Select View Code and paste this into the new codewindow that opened
(usually on the right).

If that dynamic update means something else that doesn't cause recalculations,
maybe you could tie into what ever updates that cell (a macro that refreshes a
query and does the other work, too????)



Ken wrote:

I have a dynamic stock quote in cell "B2" ... in cell "C2" I want to record
the exact time that the stock price FIRST reachs a certain price. How do I
have this cell record this exact time only the first time the stock is at
this price and not change it later?
--
Ken


--

Dave Peterson
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:08 AM.


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