Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run until mouse moves?

i've a fun question

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

i got the bright idea to use this to update a cell containing th
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 anothe
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 i
inelegant. since i can't change the selection, i'd like to have i
notice the movement of the mouse, and terminate on that. is tha
possible?

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

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target A
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, ByVa
Target As Excel.Range)

Call Workbook_SheetChange(Sh, Target)

End Sub

'end cod

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default run until mouse moves?

i didn't have one that called the API, but i knew it could be done tha
way. and i don't need this for any project, i'm just experimenting.

but i was not aware of ontime, so if it do need to look into thi
further i will look into that. it is certainly smarter tha
intentionally looping code

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

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
Text box moves around Nathan Charts and Charting in Excel 1 December 28th 06 12:41 AM
my mouse moves diagonally when i scroll on mouse? BKMISHRA Excel Worksheet Functions 0 June 29th 05 11:43 AM
Tab key moves DCZ Excel Discussion (Misc queries) 1 June 28th 05 06:53 PM
Excel now moves Left & Right when I scroll the mouse not Up & Down Randyz77 Excel Discussion (Misc queries) 0 May 2nd 05 04:32 PM
moving mouse highlights cells without touching left mouse button bremboy Excel Discussion (Misc queries) 2 January 27th 05 06:19 PM


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