+ Reply to Thread
Results 1 to 3 of 3

Macro To Get Minimum Row Number Where Criteria is Met

  1. #1
    Registered User
    Join Date
    12-13-2012
    Location
    Minnesota
    MS-Off Ver
    Excel 2010
    Posts
    40

    Question Macro To Get Minimum Row Number Where Criteria is Met

    I have this piece in my macro the identifies duplicate data based on the value in column B. It then deletes rows if the date value in column D where that date is the oldest date(s) and only keeps the most current one. Prior to this code I do sort the worksheet in ascending order (column B) then descending (column D).

    Please Login or Register  to view this content.
    This worksheet can grow to be thousands of rows. So I would like to revise this so it only needs to go through the rows that fall between the minimum row number where the criteria is met and the lrow which is already determined. How do I get the row number I want to stop the row deletion process as it works it's way up row by row? So let's say the first duplication of the value in column B was found in row number 500 and I want to stop with the deletion process when it reaches that minimum row number.

    Any help or insight is greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Macro To Get Minimum Row Number Where Criteria is Met

    Can you send a short sample to illustrate your data

  3. #3
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Macro To Get Minimum Row Number Where Criteria is Met

    There are a lot of ways you can do this, I guess it just depends on how you want to do it. One way would be for you to hard code each time the max and the min row. (like this)

    Please Login or Register  to view this content.
    Another way would be to prompt yourself with 2 input boxes prior to the code running (something like this)

    Please Login or Register  to view this content.
    *Note: I left out a lot of error checking here

    You could also build a userform and just collect the info once each time. Many more ways to do it, i figured i would give you these ones.

+ 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. Get the minimum value when there are two matches for the criteria
    By Akriti9 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2012, 12:58 AM
  2. Minimum Nonzero With Criteria
    By jaybeas in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-20-2011, 06:52 PM
  3. Find minimum SUM if no minimum number in row
    By zbor in forum Excel General
    Replies: 9
    Last Post: 12-25-2009, 05:04 AM
  4. Minimum based on criteria
    By SportsScientist in forum Excel General
    Replies: 3
    Last Post: 07-06-2009, 06:36 AM
  5. [SOLVED] Minimum and Maximum with Complex Criteria
    By manoshde@gmail.com in forum Excel General
    Replies: 4
    Last Post: 12-16-2005, 02:40 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