Pass named range to user defined function returns #value!
On Fri, 9 Nov 2007 19:40:00 -0800, IneedHelp
wrote: I always use option explicit, so typo's are not the issue...the example was not copied from the VBE. There must be something else that I am missing on refering to named ranges. BTW I am using 2003 Well, if that's the case, then most likely your named ranges are multicell ranges. So you have to treat them as such. You can't just refer to the named range as if it were a single cell range, if it is not. For example, modifying your routine a bit: --------------------------------- Option Explicit Public Function MyFunction(qtyIn, priceIn) Dim c As Range For Each c In qtyIn Debug.Print c Next c MyFunction = Application.WorksheetFunction.SumProduct(qtyIn, priceIn) End Function --------------------------------- --ron |
All times are GMT +1. The time now is 12:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com