Reference Sheet in Add-In not Active Workbook

vb2themax

New Member
Joined
Jan 22, 2009
Messages
1
I have an add-in that has a formula that uses a named range on one of it's sheets to lookup values needed to complete the calculation. My question is how do I in the formula located in the Add-in reference the sheet in the Add-in and not the ActiveWorkbook:

Snippet of my code in the add-in:
---------------------------------
' Location for Exact Mass data
Set wsSheet = ThisWorkbook.Sheets("Mass_Table")
---------------------------------

need this to be something like:
---------------------------------
' Location for Exact Mass data
Set wsSheet = ThisAddIn.Sheets("Mass_Table")
---------------------------------

I would like to use this calculation in other sheets but each time I do, it will not work because there is no "Mass_Table" sheet in the workbook I am trying to user the UDF in, it is located in the Add-in only.

Hope this makes sense. Any help would be appreciated.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top