Worksheets events

  • Thread starter Thread starter Brad
  • Start date Start date
B

Brad

Where is a good site to explain the difference between the following VBA codes?

Worksheet_Change
Worksheet_SelectionChange

Looking at Walkenbach 2003 (VBA book) pages 621-626. I'm confused
is SelectionChange before you hit enter and Worsheet_Change after you hit
enter?
If it is possible to have both is there an order that has to be followed.
 
Brad,

I'm not sure you'll get a better reference site/book then JWalk

Worksheet_SelectionChange
Is just that and has nothing to do with changing the contens of a cell.
change the selection to a different cell and the event fires.

Worksheet_Change

This requires a cell value on the sheet to be changed but won't be fired if
a formula output changes unless it was a cell on the same sheet that caused
the formula value to change. It isn't linked to ENTER. Change a value of a
cell and TAB out and the event fires.

One place where the unaware can really fall over is that if you use
worksheet event code to change a cell value then that calls the event again
so you get another call.

have a look at enableevents for how to get around this.

Mike
 

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