Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
RAND() Won't Trigger Worksheet_Change
I put a random number cell on my worksheet, and I want to be able to run some
code in the Worksheet_Change routine every time that cell is updated. I have discovered that when that cell updates, Excel is not considering it a "change" - the event is not triggered. Any ideas as to why this is, and how I can work around it? I know the code is working, because if I type "=RAND()" in that cell again and hit Enter, the event is triggered because I changed the formula of the cell. Also, if I just type a number of text into the cell, the event is triggered. Thanks, Eric |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
RAND() Won't Trigger Worksheet_Change
Worksheet_change catches your typing.
Maybe you want to use to use the worksheet_calculate event??? egun wrote: I put a random number cell on my worksheet, and I want to be able to run some code in the Worksheet_Change routine every time that cell is updated. I have discovered that when that cell updates, Excel is not considering it a "change" - the event is not triggered. Any ideas as to why this is, and how I can work around it? I know the code is working, because if I type "=RAND()" in that cell again and hit Enter, the event is triggered because I changed the formula of the cell. Also, if I just type a number of text into the cell, the event is triggered. Thanks, Eric -- Dave Peterson |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
RAND() Won't Trigger Worksheet_Change
You need to use a different event, the Worksheet Calculate event.
-- Gary''s Student - gsnu200832 "egun" wrote: I put a random number cell on my worksheet, and I want to be able to run some code in the Worksheet_Change routine every time that cell is updated. I have discovered that when that cell updates, Excel is not considering it a "change" - the event is not triggered. Any ideas as to why this is, and how I can work around it? I know the code is working, because if I type "=RAND()" in that cell again and hit Enter, the event is triggered because I changed the formula of the cell. Also, if I just type a number of text into the cell, the event is triggered. Thanks, Eric |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
RAND() Won't Trigger Worksheet_Change
Hadn't thought about Worksheet_Calculate. I'll give it a try.
Thanks guys! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
RAND() Won't Trigger Worksheet_Change
Okay, just realized this - the Worksheet_Calculate routine does not have
"Target" as an argument. How do I know if my specific cell has been updated? Since it's a volatile function, is it safe to assume it changed any time the worksheet is recalculated? Thanks again, Eric |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
RAND() Won't Trigger Worksheet_Change
For the cell with =rand(), yep. Since it's volatile.
If you had a cell that contained a formula that may not change during a recalculation, you'd have to keep track of that cell's value your own self. egun wrote: Okay, just realized this - the Worksheet_Calculate routine does not have "Target" as an argument. How do I know if my specific cell has been updated? Since it's a volatile function, is it safe to assume it changed any time the worksheet is recalculated? Thanks again, Eric -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Run VBA code only worksheet change, but don't trigger worksheet_change event based on what the code does | Excel Programming | |||
Trigger Macro by Worksheet_Change | Excel Discussion (Misc queries) | |||
data validation list does not trigger worksheet_change event | Excel Programming | |||
Worksheet_Change wont Trigger | Excel Programming | |||
Worksheet_Change sub does not trigger a called macro | Excel Programming |