+ Reply to Thread
Results 1 to 3 of 3

VBA function - Find max value of a range

  1. #1
    Registered User
    Join Date
    12-23-2014
    Location
    London, England
    MS-Off Ver
    2003
    Posts
    9

    VBA function - Find max value of a range

    Hi,

    I''ve been teaching myself VBA as a first step into programming with Office. A little over a year ago I got some help to solve an array formula topic as below
    http://www.excelforum.com/excel-form...ric-value.html

    As a first trial i've tried to achieve the same result using VBA. I've tested the VBA as a sub routine and it returns the largest value in an active selection range which was perfect. But when I change it to a function it throws a an invalid name error. So my question is any pointers on why this works as a subroutine but not a function? Secondly if you're able to suggest better VBA to achieve the same ends please do.




    Please Login or Register  to view this content.
    Last edited by rgimblett; 01-23-2016 at 03:24 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: VBA function - Find max value of a range

    Where is the code sitting - it needs to be in a module and not the ThisWorkbook tab.
    Martin

  3. #3
    Registered User
    Join Date
    12-23-2014
    Location
    London, England
    MS-Off Ver
    2003
    Posts
    9

    Re: VBA function - Find max value of a range

    The code is in a module of the workbook I want to use it on.
    I should say I'm using Excel 2010. I intend for this to work on Excel 2003 as well.

+ 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. Copy Range with Find Function
    By rodgersmg in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2015, 10:12 AM
  2. Range.Find function fails to find a match but For loop confirms that match exists
    By 6StringJazzer in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2013, 03:35 PM
  3. Find Range Function
    By smuzoen in forum Excel Tips
    Replies: 3
    Last Post: 07-05-2012, 07:07 PM
  4. Subscript out of range with find function
    By cferoiu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-05-2011, 05:35 PM
  5. find function with a relative range
    By adevins76 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-02-2010, 03:45 PM
  6. IF function to find an item within a range.
    By Steve-B in forum Excel General
    Replies: 4
    Last Post: 03-11-2009, 05:36 AM
  7. Function to find first non-zero value in a range
    By paulabrozek in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-28-2008, 04:07 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