+ Reply to Thread
Results 1 to 4 of 4

Function Return Range

  1. #1
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    314

    Function Return Range

    Hi all,

    Using Excel 2010.

    Trying to return a Range Object from a Function, but I receive "Object Required" from the calling Sub().

    I printed the Range Address from the Function that means the Range exists, at least in the Function.

    Thoughts on what I am doing wrong?

    thx
    w

    debug.print output
    rng $A$1:$N$7602
    GetExcelRangeFunc $A$1:$N$7602
    Please Login or Register  to view this content.
    Kind regards,
    w

    http://dataprose.org

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Function Return Range

    A range object refers to a range in an open workbook; your sub closes the workbook before exiting.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    01-07-2004
    Posts
    314

    Re: Function Return Range

    Thanks Shg,

    Revised Function below.
    The lesson learned: keep Function really simple to a singular purpose.

    thx
    w

    Please Login or Register  to view this content.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Function Return Range

    Good job.

    Or, more compactly,

    Please Login or Register  to view this content.
    Last edited by shg; 04-19-2015 at 07:44 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Return the Range From a Lookup Function
    By cmore in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-15-2014, 08:58 AM
  2. How to write a function to return a value within a given value range
    By Sonnerstudent in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-22-2013, 04:31 PM
  3. Function to return MAX value for a range
    By jwright650 in forum Excel General
    Replies: 8
    Last Post: 02-08-2011, 11:14 AM
  4. How to make an if/and function examine range and return
    By mkmed in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-06-2007, 05:45 PM
  5. [SOLVED] custom function - return range
    By GinaW in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-19-2006, 07:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1