#1   Report Post  
Posted to microsoft.public.excel.misc
climax
 
Posts: n/a
Default newbee got a problem


Hi,

Here is the setup:
I get streaming data in cell g2. I want to compare this data with the
previous data in this cell so I copy the old data in cell g3. If G3 is
4 points less I must send a string to a api system to buy stock.

This is what I came up with:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("g2") < Range("g3") - 4 Then
Range("c10") = Range("c10") + 1 (<= this where the string should be.
NOW TESTING )
Range("g3") = Range("g2")
Range("g3") = Range("g3")
End If

End Sub


This works but only when I click on the sheet when G2 changes.
I tried to put it in a macro with loop but then my streaming data
doesn´t work.
I am a newbee so please can sommeone help me on the right track?

Thanks


--
climax
------------------------------------------------------------------------
climax's Profile: http://www.excelforum.com/member.php...o&userid=30816
View this thread: http://www.excelforum.com/showthread...hreadid=506297

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default newbee got a problem

Try this

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "G2:G3"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
If Me.Range("G2") < Me.Range("G3") - 4 Then
Me.Range("C10") = Me.Range("C10") + 1
Me.Range("gG3") = Me.Range("G2")
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"climax" wrote in
message ...

Hi,

Here is the setup:
I get streaming data in cell g2. I want to compare this data with the
previous data in this cell so I copy the old data in cell g3. If G3 is
4 points less I must send a string to a api system to buy stock.

This is what I came up with:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Range("g2") < Range("g3") - 4 Then
Range("c10") = Range("c10") + 1 (<= this where the string should be.
NOW TESTING )
Range("g3") = Range("g2")
Range("g3") = Range("g3")
End If

End Sub


This works but only when I click on the sheet when G2 changes.
I tried to put it in a macro with loop but then my streaming data
doesn´t work.
I am a newbee so please can sommeone help me on the right track?

Thanks


--
climax
------------------------------------------------------------------------
climax's Profile:

http://www.excelforum.com/member.php...o&userid=30816
View this thread: http://www.excelforum.com/showthread...hreadid=506297



  #3   Report Post  
Posted to microsoft.public.excel.misc
climax
 
Posts: n/a
Default newbee got a problem


Thanks
My straeming data in cell g2 works ok, but cell g3 doesn´t change so it
can´t compare old with new data. Cell c10 works ok ( Tried it by
entering higher value in g3 )


--
climax
------------------------------------------------------------------------
climax's Profile: http://www.excelforum.com/member.php...o&userid=30816
View this thread: http://www.excelforum.com/showthread...hreadid=506297

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
have some problem with database baldamenti Excel Discussion (Misc queries) 1 October 13th 05 05:38 PM
Urgent Help Required on Excel Macro Problem Sachin Shah Excel Discussion (Misc queries) 1 August 17th 05 06:26 AM
Problem With Reference Update Egon Excel Worksheet Functions 17 July 16th 05 05:45 AM
Copy an Drag cell Formula Problem Nat Excel Discussion (Misc queries) 1 June 20th 05 03:24 PM
Freeze Pane problem in shared workbooks JM Excel Discussion (Misc queries) 1 February 1st 05 12:04 AM


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