Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Text box moves around | Charts and Charting in Excel | |||
my mouse moves diagonally when i scroll on mouse? | Excel Worksheet Functions | |||
Tab key moves | Excel Discussion (Misc queries) | |||
Excel now moves Left & Right when I scroll the mouse not Up & Down | Excel Discussion (Misc queries) | |||
moving mouse highlights cells without touching left mouse button | Excel Discussion (Misc queries) |