ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cells with formula fire worksheet_change when navigating thru them (https://www.excelbanter.com/excel-programming/439485-cells-formula-fire-worksheet_change-when-navigating-thru-them.html)

pwrob

cells with formula fire worksheet_change when navigating thru them
 
hi, i have cells that contain diff. formula and the first time i enter any
one of them then leave it (eg. use arrow key to scroll across columns in a
given row) the worksheet change event is fired. is this a bug because
nothing has changed in the cell (perhaps some recalculate event has fired?).

the reason the above noted behaviour is a problem is because in my
worksheet_change event i execute an
Application.Undo
and this line of code throws an error because nothing there is nothing to
undo because nothing has actually changed. i don't know how to test for
whether there is anything to undo. i found something about the undo list but
can't figure out the syntax to access this "object".
any help would be wonderful...
cheers, pwrob

--
xl help seeker

JLGWhiz[_2_]

cells with formula fire worksheet_change when navigating thru them
 
Without seeing the worksheet event code, your questions cannot be answered
with accuracy. However, it is doubtful that there is a bug in the system
software. The problem is most likely in the structure of the event code.
This can oftem be remedied by using an If ... Then statement to set a
criteria that must exist before the event code will fire.

As and example only:

Private Sub Worksheet_Change(ByVal Target As Range)
If Taget = Range("C5" ) Then
'Do something
End If
End Sub

If the target range was C5 then the code would execute the Do Something
line, otherwise it does nothing.



"pwrob" wrote in message
...
hi, i have cells that contain diff. formula and the first time i enter
any
one of them then leave it (eg. use arrow key to scroll across columns in a
given row) the worksheet change event is fired. is this a bug because
nothing has changed in the cell (perhaps some recalculate event has
fired?).

the reason the above noted behaviour is a problem is because in my
worksheet_change event i execute an
Application.Undo
and this line of code throws an error because nothing there is nothing to
undo because nothing has actually changed. i don't know how to test for
whether there is anything to undo. i found something about the undo list
but
can't figure out the syntax to access this "object".
any help would be wonderful...
cheers, pwrob

--
xl help seeker





All times are GMT +1. The time now is 05:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com