Accessing Named Range In UDF

djt76010

Board Regular
Joined
Feb 23, 2007
Messages
109
I have written this function in a macro enabled spreadsheet and it works as expected if I pass in the named range "TESTRANGE" that refers to a range in that spreadsheet. When I save that spreadsheet as an .xlam file and add it as an add-in the function no longer works. Is there some adjustment I need to make in order to access a named range in the .xlam file?

Code:
Function TEST_1(Number, DATA)

    Dim DATA_RANGE As Variant
    
    DATA_RANGE = Range(DATA).Value
          
    TEST_1 = DATA_RANGE(Number, 1)

End Function

Thanks in advance
 

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.
Yes, I *think* that's what the OP wants ... i.e., storing data in named ranges in the xlam. Though I could have it backwards, in which case the penultimate solution is best.
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,259
Members
452,901
Latest member
LisaGo

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