Results 1 to 7 of 7

Find Specific Number - If not found find next lowest number

Threaded View

  1. #1
    Registered User
    Join Date
    02-23-2012
    Location
    FL
    MS-Off Ver
    Excel 2007
    Posts
    55

    Find Specific Number - If not found find next lowest number

    Hola! So I'm a bit stuck at the moment. I'm trying to search a column for a specific number which is set by an input box. The column is sorted from Largest > Smallest. I originally had this code to find the number:
    Selection.Find(What:=inputNum, After:=ActiveCell, LookIn:=xlValues, LookAt:=xlPart, SearchOrder:=xlByRows, _
                       SearchDirection:=xlNext, MatchCase:=False, SearchFormat:False).Select
    
    rowNum = Range(ActiveCell.Address).Row
    So what I'm trying to do is find the very first cell that contains the specified number. The problem is if the number isn't found the script fails. I would like it to search for the next closest number that is smaller than the originally number. I've tried using a For/Next statement but that has to search line by line and takes a bit more time. Is there a way to do what I need that is fast? Any help is greatly appreciated!
    Last edited by mattyp; 04-14-2017 at 10:25 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 10-07-2016, 02:16 PM
  2. VBA To find nearest biggest number and lowest number
    By gan_xl in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2014, 05:49 AM
  3. Replies: 5
    Last Post: 02-13-2014, 05:37 PM
  4. [SOLVED] Find number and delete until tje number is not found above it
    By ScabbyDog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2013, 04:36 PM
  5. Find lowest number in groups then lowest overall.
    By swieduwi in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-24-2008, 01:00 PM
  6. find lowest number?
    By qscesz in forum Excel General
    Replies: 4
    Last Post: 01-22-2008, 07:51 AM
  7. [SOLVED] find the lowest value in a row and add a number to it
    By Kim in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 09-28-2005, 01:05 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