![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Posts: 107
|
Is there similar code that will kick off a macro when any cell is selected in any worksheet in the entire workbook? Since new sheets will be added at any time, I cannot simply add the above Private Sub to all current worksheets.
I am looking for something like: Private Sub Workbook_SelectionChange(ByVal Target As Excel.Range) (although i know the above does not actually exist) |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: San Francisco, California USA
Posts: 10,388
|
You were close. The code line is
Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range) |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Kobe, Japan
Posts: 1,420
|
Hi. Please copy this into a ThisWorkbook module.
The event you want is already exist.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|