Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Worksheet Selection_Change Event in Addin 1

Status
Not open for further replies.

drrocket5292

Technical User
Sep 6, 2005
73
0
0
US
Hi,
I've created in addin for excel that uses a userform to pull information from an access database and puts it into excel. i've also created a procedure using the worksheet selection_change event that allows the user to click on a cell that has a company name it (one of the fields returned from the SQL query) and it will drilldown and show all of that company's activity for whatever time period is specified. here's my problem: the worksheet selection_change event works perfectly when i put the code into a specific workbook but i cant figure out how to throw it into the addin and get it to work. does anyone know how to do this? if i put it into sheet1 of the addin it does nothing because that addin sheet1 is not in the workbook that has the data in it.
the set up for the addin is a commandbarbutton that the user can click on at any time which opens the userform which then dumps the data into the activesheet. i really dont want to have the enduser have to open a specific workbook to get this drilldown function to work so if anyone knows how to fix this that would be greatly appreciated. thanks for the help.

 
Hi,

you'll need to use the Application_SelectionChange event.

These events will fire whenever the event occurs in any open workbook within the application.

Check the Help for "Using Events with the Application Object" on help how you have to access these events.

You can then specify it to work only when the particular workbook and sheet are being used.



Cheers,

Roel
 


Roel,

I learned something today! Thanx!

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
You could also check out Class Modules. Although it may be a little more confusing for the same results.

Regards,
Zack Barresse

Simplicity is the ultimate sophistication. What is a MS MVP? PODA
- Leonardo da Vinci
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top