ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Worksheet Change from Add-In (https://www.excelbanter.com/excel-programming/404503-re-worksheet-change-add.html)

Jim Thomlinson

Worksheet Change from Add-In
 
Yes it is possible but your addin will be listneing to all open workbooks and
all sheets witning those workbooks. your addin will need to determine which
sheet in which book the change is being made in. Here is a link to
application level events that will allow your addin to listen to events
generated in all open workbooks...

http://www.cpearson.com/excel/AppEvent.aspx
--
HTH...

Jim Thomlinson


"scott" wrote:

I have the below code behind "Sheet1". I have an add-in that loads whenever
this particular workbook opens and I always try to keep my code within the
..xla add-in file.

Because one of my needs for this workbook is to take action if the values
change in A:2 or B:2, I have the code below in the "Sheet1" Worksheet_Change
sub.

Is there any code that could be used in the add-in that would achieve the
same task of monitoring cells A2 and B2 for change, but reside in the .xla
add-in instead of in the Worksheet_Change sub within "Sheet1"?

CODE:

Private Sub Worksheet_Change(ByVal Target As Range)


Select Case Target.Address

Case Is = "$A$2"
' Do something ...
Case Is = "$B$2"
' Do something ...

End Select

End Sub





All times are GMT +1. The time now is 05:28 PM.

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