+ Reply to Thread
Results 1 to 5 of 5

Find Largest Values Greater than 'X' in VBA

  1. #1
    Registered User
    Join Date
    04-06-2012
    Location
    Charlotte, NC
    MS-Off Ver
    Excel 2010
    Posts
    7

    Find Largest Values Greater than 'X' in VBA

    Currently I have a pretty good macro that almost performs the task I want (see below). I would like for this macro to find all values greater than or equal to the value the user chooses in a particular cell.
    Right now the macro below is pulling the 15 largest values, (Dim lLarge(1 To 15) As Long) but I would like for it to only pull the values larger than the cell I have designated as losslimit (and I would like for the user to be able to change this number whenever he/she wishes).

    Note: The part of the macro that pulls the dates is working perfectly and does not need to be altered.
    I have attached the workbook that is the final product. I have filled in some dummy values already. To better explain, if the user put 50,000 into C15 (of WC Summary) the 'Details' table should show only values 600,000; 111,100; 100,000; & 50,000 (these values found in WC Input with arrays named WC_YearX). If the user were to change C15 to 200,000, the 'Details' table should only show 600,000.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Leith Ross; 04-11-2012 at 02:14 PM. Reason: Added Code Taqs

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Find Largest Values Greater than 'X' in VBA

    mabeaver,

    In the future, please wrap your code in code tags per the forum rules (link in my sig).
    As to your question, I think something like this is what you're looking for:
    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    04-06-2012
    Location
    Charlotte, NC
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Find Largest Values Greater than 'X' in VBA

    That works great. I really appreciate the help.

    I'm going to work this into the rest of the workbook for all of the other lines of business (worksheets) and make sure it works there too.

  4. #4
    Registered User
    Join Date
    04-06-2012
    Location
    Charlotte, NC
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Find Largest Values Greater than 'X' in VBA

    So I tried applying the same code to my other worksheets (Auto Summary, GL Summary) and it worked fine for the GL, but the 'Policy Effective Date' column did not pull through correctly. I attached that portion of the spreadsheet, and used the following code:

    Please Login or Register  to view this content.
    Can you point out the portion of the code that is pulling the 'Policy Effective Date' and explain where I'm going wrong?

    Thanks!
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-06-2012
    Location
    Charlotte, NC
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Find Largest Values Greater than 'X' in VBA

    Nevermind, I figured it out. Code works great, much appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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