View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default run until mouse moves?

Sounds like a pretty bad idea.

Try looking at Ontime

http://www.cpearson.com/excel/ontime.htm

if you had a working routine that calls the API, why abandon it. What have
you saved. Your "fun" idea will probably eat up more resources than an API
call.

--
Regards,
Tom Ogilvy
"teatree " wrote in message
...
i've a fun question

i've noticed that (at least in excel 97) if you use the
workbook_sheetchange event, and you use it to update the value of two
different cells, it will throw itself into a loop as it bounces from
one update to the other.

i got the bright idea to use this to update a cell containing the
current time, to get an actively updating clock without the API call.
but i wanted it to "turn on" only when a certain cell was activated...

this required a second event, tied to the SheetSelectionChange event,
which simply called the first event

it works great... except, i thought i would be able to select another
range while the macro was running, and it would end the loop. no dice.
the only way to quit is to hit ESC, and then "End." which is
inelegant. since i can't change the selection, i'd like to have it
notice the movement of the mouse, and terminate on that. is that
possible?

'begin code
'this code is in a 'workbook' module

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Excel.Range)
If ActiveCell.Address = "$H$13" Then

Range("H2").Value = " "
Range("C4").Value = Time

End If
End Sub

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal
Target As Excel.Range)

Call Workbook_SheetChange(Sh, Target)

End Sub

'end code


---
Message posted from http://www.ExcelForum.com/