Uses for the Worksheet_SelectionChange and Workbook_SheetSelectionChange events

advertisements

As far as I understand it they do the same thing, but while

Worksheet_SelectionChange

is triggered every time selection is changed on a single worksheet,

Workbook_SheetSelectionChange

is triggered every time selection is changed in any worksheet in the workbook.

Are there any other differences between these events?


The single parameter supplied by the Worksheet_SelectionChange event macro is the cell or range of cells that have just been selected, e.g. Target. The Workbook_SheetSelectionChange supplies that but adds the worksheet where the selection was made with Sh.

If you want the same thing to happen on multiple worksheets (not necessarily all of them), use Workbook_SheetSelectionChange and deal with the Sh parameter. This also centralizes your code so that modifications do not have to be repeated in several places. If you are only planning on reacting to selection changes on a single worksheet, use that worksheet's Worksheet_SelectionChange event macro on its own sheet code page.