Worksheet_SelectionChange

  • Thread starter Thread starter mangesh_yadav
  • Start date Start date
M

mangesh_yadav

I have something like this on a larger scale:

5 cells: A1, B1 and B2, C1 and C2.

If I enter value in B1, B2 becomes 0. And vice-versa.
If I enter 0 in A1, then B1 and B2 becomes 0.
If C1 is 0 I cannot enter values in B1, and if C2 is 0 I cannot ente
value in B2.


The problem is, if I use Worksheet_Change event, then the event i
fired twice when I try to enter a value in B1 (whe C1 is 0), because
undo the action in this case, which fires the event on resetting B2.

If I use Worksheet_SelectionChange, then it works well as long as
press the ENTER button after entering a value, but if I use the arro
keys, then the whole logic goes for a toss.

Any better alternatives.....?

- Manges
 
Hi
use the worksheet_change event but before changing data in the sheet use the
statement
application.enableevents=false

And don't forget to enable them again at the end of your event procedure with
application.enableevents=true
 

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

Back
Top