Custom function which references external data


New Member
Oct 27, 2010
Parameters which can't change
I use 14 different data sets, which are stored in regression formulas (y=mx+b) in 14 different workbooks. This is equivalent to a couple of 10x10 values tables in each file. These data sets are referenced in ton of workbooks in a various tedious way. I want to streamline this.

My first thought (good thought I think), was to create a custom function which pulls from the appropriate data source based on parameters. I can then save this function as an excel add-in so its available in all workbooks which would use the reference. Bad idea - my mistake is the custom function uses data in closed workbooks, and although I can use vba to open these workbooks, get the data required, and close the workbook behind the scenes, this seems cumbersome and clunky when done on a larger scale.

My next thought is to somehow aggregate the data sets into one txt file that can be stored with the excel add-in. I have no experience in this. Any thoughts from those with experience?

Once implemented, this will affect multiple users over several years, so I want to make sure this is a good solution.


Well-known Member
Jun 12, 2009
My next thought is to somehow aggregate the data sets into one txt file

Why not store your data in one of the worksheets of your add-in?

Remember, when you reference an add-in worksheet sheet in the add-in code to use the ThisWorkbook object.
Set myRange =
ThisWorkbook.Worksheet("Data").Range("A1:A2") - this references a sheet named Data in the add-in.


Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...