Help with creating Excel Add-Ins

Twi78

New Member
Joined
Mar 27, 2012
Messages
18
I have created an excel workbook with many defined functions. These functions are calculated by looping through an array (that is populated from an excel sheet in the same file) and where user defined parameters are entered. For example MachineAOutput(Year,Month,ProductType). Everything works in the workbook fine but entering the function in another workbook (both before and after creating the Add-In) doesnt work, it just retunrs a zero. This suggests the function is recognised but the array that the function reads from is not populated.

I have created the Add-In from the original file which has all the data etc. but I can't run the Sub procedure that populates the array as I get a 'Subscript out of range' error?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Without seeing your code I can only offer some general advice.

Make sure your code is in a standard module, i.e., Insert=>Module.

The add-in is effectively on a separate workbook. Be aware of the scope of your function, i.e., Public or Private.

Your subscript out of range error indicates that you are not referencing the correct workbook when assigning ranges.

The ThisWorkbook object is the workbook containing the add-in.
Rich (BB code):
'Theis s the add-in workbook
Set wb = ThisWorkbook

Rich (BB code):
'this refers to the user's workbook
Set wb = ActiveWorkbook

See if this link help you to debug your code:
Creating an Excel Add-in. How To Create an Add-in To Store Your Excel VBA Macros
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,876
Members
452,363
Latest member
merico17

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