ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheets events (https://www.excelbanter.com/excel-programming/426356-worksheets-events.html)

Brad

Worksheets events
 
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.

Mike H

Worksheets events
 
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






"Brad" wrote:

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.



All times are GMT +1. The time now is 03:44 AM.

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