cells with formula fire worksheet_change when navigating thru them

P

pwrob

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
 
J

JLGWhiz

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top