Otto,
is this working for you (referring to manually done changes)?
I tried also this, but when the change event happen, I store the new values,
call the Undo, read the previous values, but then I'm unable to call a
Repeat to return to the situation after the changes.
In facts, the code I'm using causes a strange effect since I cannot Repeat
any action even using the standard Excel button: you see the application
repeating the action, but then the Undo is applied by the macro while the
repeat is not.
Here is the code I'm using.
Application.EnableEvents = False
Call StoreValues(True, True, Wb, Ws, Rng) 'read values after change
Application.Undo
Call StoreValues(False, True, Wb, Ws, Rng) 'read values before change
Application.Repeat
Application.EnableEvents = True
I'm thinking that I can simulate a Repeat writing via macro the new values
into the cells, since I've stored them, but I'm worried about formats and
comments and whatever the user can have changed in the cells, apart from the
values, with just one single copy and paste operation from the GUI.
Do you think I can use something like:
dim R as Range
set R= Rng 'where Rng is the range where the change happened, passed
by the SheetChange event
Application.EnableEvents = False
Call StoreValues(True, True, Wb, Ws, Rng) 'read values after change
Application.Undo
Call StoreValues(False, True, Wb, Ws, Rng) 'read values before change
set Rng = R 'so meaning that everything is copied to the worksheet
range: values, formatting, comments, names, etc.
'Application.Repeat
Application.EnableEvents = True
Thanks,
Paolo