View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Posting again. Please Help! How to "track changes" using VBA

Tushar & Paolo,

I do duplicate the order of events as described by the Paolo. Namely, with
autofill (drag or double click the handle) the _Change event occurs before
the _SelectionChange (XL2k).

In addition to this problem and the "Edit | Fill Series" issue there could
be other reasons for the method to fail to pick up all changes, eg change
the layout of the sheet (no events for insert/delete cells), change the
value of a cell second time (no _SelectionChange event if still same active
cell), and more. There are more reliable methods with downside of more code
& use of resources if a large used range.

Regards,
Peter T

"Tushar Mehta" wrote in message
...
I cannot duplicate that problem -- at least not with XL2003. I tested
with both worksheet level events and application level events. I also
tested by dragging the bottom-right corner down a column as well as
double-clicking the same corner.

In all cases the _SelectionChange event occured before the _Change
event.

However -- and as expected -- it is possible to fake out the method you
use to track changes. Just use the Edit | Fill Series... and only
the _Change event will be triggered. I tested with a linear series.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I'm trying to rewrite a sort of the "track changes" feature of Excel

using
VBA.
The method I'm following is to store in a variable the value of the

active
cell/range every time the application event "selection change" is

triggered.
Then, we a change happens ("sheet change" event is triggered) I compare

the
new value with the previously stored variable.

This works fine when the user changes cells using "normal" methods like

just
writing into
a cell or copying and pasting.

However, it doesn't work when using the autofill method: dragging
(or double clicking) the small dot at bottom right corner of the

selection
marker.
In this case the "change" event is triggered BEFORE the "selection

change"
event, and not after as in "normal" methods.
So in this case the application cannot store the values/formulas the

cells
had before they were changed, thus I can't compare changes.

That's the SheetChange event declaration I'm using. Maybe I'm missing
somthing?
Private Sub App_SheetChange(ByVal Sh As Object, ByVal Target As Range)

I wonder whether there's a complete different way for doing that, like
having a method of the range object that is passed to the "Sheet Change"
event
that stores the value/formula the range had before the change.

Do you have any idea for solving the above issue?
Many thanks for your help.

Paolo
Milan, Italy