ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert code into each worksheet's "Sub Worksheet_SelectionChange" Function (https://www.excelbanter.com/excel-programming/277723-insert-code-into-each-worksheets-sub-worksheet_selectionchange-function.html)

John[_46_]

Insert code into each worksheet's "Sub Worksheet_SelectionChange" Function
 
Is there a way to have a module insert a piece of code
into the each worksheets "WorkSheet_SelectionChange"
function. The worksheets are newly created so that is why
I have to insert the code from a module.

Thanks,
John

steve

Insert code into each worksheet's "Sub Worksheet_SelectionChange" Function
 
John,

Try this site:
http://www.cpearson.com/excel/codemods.htm

--
sb
"John" wrote in message
...
Is there a way to have a module insert a piece of code
into the each worksheets "WorkSheet_SelectionChange"
function. The worksheets are newly created so that is why
I have to insert the code from a module.

Thanks,
John




Dave Peterson[_3_]

Insert code into each worksheet's "Sub Worksheet_SelectionChange"Function
 
If it's all the same code, maybe you could use:
Workbook_SheetSelectionChange

It's under the ThisWorkbook module.

Private Sub Workbook_SheetSelectionChange _
(ByVal Sh As Object, ByVal Target As Range)

When you're testing, add a line (just to see how it passes important info):

msgbox sh.name & vblf & target.address

John wrote:

Is there a way to have a module insert a piece of code
into the each worksheets "WorkSheet_SelectionChange"
function. The worksheets are newly created so that is why
I have to insert the code from a module.

Thanks,
John


--

Dave Peterson



All times are GMT +1. The time now is 10:43 PM.

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