Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass named range to user defined function returns #value! JMB Excel Programming 1 November 10th 07 12:24 PM
Pass named range to user defined function returns #value! Bob Phillips Excel Programming 0 November 10th 07 11:56 AM
Passing a named range into a user defined function Simon Shaw Excel Programming 2 March 15th 05 09:33 PM
User Defined Function used in Macro returns #VALUE hodler Excel Programming 1 July 30th 04 03:46 AM
passing named range to a UDF user defined function Brian Murphy Excel Programming 3 June 13th 04 08:38 PM


All times are GMT +1. The time now is 08:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"