ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA: How to track changed cells (https://www.excelbanter.com/excel-programming/340814-excel-vba-how-track-changed-cells.html)

Jens Lenge

Excel VBA: How to track changed cells
 
Hello world,

I'd like to have an Excel 2003 VBA macro be automatically called each time
that the user changes the value of a cell (by either directly entering a new
value of using copy/paste).

* How can I make my macro be automatically called in such a case?
* How can I detect which cells was changed from inside the macro?

My macro should check the new cell value and change it under certain
conditions. In case the cell value is changed by my macro, is there a way to
prevent the macro from being called again for the same cell?

Jens


David McRitchie

Excel VBA: How to track changed cells
 
Hi Jens,
Within a macro, you are in control and should program accordingly.

For changes of constants (text or numbers) you can use a
Worksheet Change Event, which can be selective as to which
columns or rows you want to ignore or accept changes from.
http://www.mvps.org/dmcritchie/excel/event.thm
and inserting or deleting rows would be another matter.

I don't think you will find recording changes very practical. The
builtin Highlight Change is a major nuisance, for all but a few things
like a final version (mignt be practical, but still a nuisance even for that purpose).
Highlight, Change Highlighting
http://www.mvps.org/dmcritchie/excel/highlite.htm
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Jens Lenge" wrote in message ...
Hello world,

I'd like to have an Excel 2003 VBA macro be automatically called each time
that the user changes the value of a cell (by either directly entering a new
value of using copy/paste).

* How can I make my macro be automatically called in such a case?
* How can I detect which cells was changed from inside the macro?

My macro should check the new cell value and change it under certain
conditions. In case the cell value is changed by my macro, is there a way to
prevent the macro from being called again for the same cell?

Jens




Jens Lenge

Excel VBA: How to track changed cells
 
I'll have a look.
Thanks for your advice!


All times are GMT +1. The time now is 07:23 PM.

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