Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88066

Run macro on change within target range | Change (ByVal Target As Range)

$
0
0

I'm working with the Worksheet_Change(ByVal Target As Range) event.

I wanted to run a macro if either on of cells A1 or A2 are changed. So the target range is set to [A1, A2]

Then, if A1 is changed, I want to clear A2, or the other way around (A2 is changed: clear A1).

Now the problem:

If A1 value is changed. the macro clears A2. That's seen as a change in A2, so it clears A1, which is a change, etc...

I'm sure it's something simple, but I can't see how I can have cell A1 be changed without triggering the change macro if A2 is being cleared.

Anyone who has experience in this?


Viewing all articles
Browse latest Browse all 88066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>