UDF only works with named range

chrisk0420

New Member
Joined
May 5, 2011
Messages
6
I have a function that only works if I have a range named returns. I need it to work when an range is chosen for the argument

Function test(returns)

test = Evaluate("=PRODUCT(1+returns/100)")

End Function

Any help would be greatly appreciated
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Try

Code:
Function test(returns As Range)

test = Evaluate("=PRODUCT(1+" & returns.Address & "/100)")

End Function
 
Upvote 0
The above function now works fine as long as I store the code in the workbook it is being used in. When I save it as an XLA file, it works fine in a workbook with one worksheet. With Multiple worksheets it still calculates fine while the workbook is open, but once I close and reopen it the only worksheet that calculates correctly is the one I was in when I saved it. The rest of the sheets don't calculate until I manually recalculate each sell with the formula...

I have tried adding application.volatile, adding code to the workbook open to force all formulas to recalculate. Nothing works

Any help would be greatly appreciated
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,451
Members
452,915
Latest member
hannnahheileen

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