+ Reply to Thread
Results 1 to 4 of 4

only continue if number matches

  1. #1
    Registered User
    Join Date
    01-31-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    72

    only continue if number matches

    Hi,

    This should be simple... I think I'm over complicating it..

    I need a piece of code that will check an inputted number against a column of numbers and if the inputted number doesn't match any of the numbers then a message will pop up saying "Account Number doesn't exist" and then after clicking OK it exits the sub... If the inputted number matches then continue with sub..

    Please Login or Register  to view this content.
    I know this is completely wrong but it's been a long day and my brain hurts noaccount goes to the end of the sub where the msgbox resides..

    Cheers,

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: only continue if number matches

    This is not tested as no sample workbook to try it out on but off the top of my head something like this should work.
    Please Login or Register  to view this content.
    Note, if you're only interested in if the reference is there or not rather than which row it's found in (or not) then you could just use FIND rather than looping through row by row.
    It would be a lot quicker if you have LOTS of data.

    Something like:
    Please Login or Register  to view this content.
    BSB
    Last edited by BadlySpelledBuoy; 02-02-2021 at 03:49 PM. Reason: SLIGHTLY MISUNDERSTOOD THE REQUEST. CODE AMENDED TO DO WHAT'S ASKED FOR.

  3. #3
    Registered User
    Join Date
    01-31-2021
    Location
    London
    MS-Off Ver
    365
    Posts
    72

    Re: only continue if number matches

    Thanks Badly,

    Worked a charm

  4. #4
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: only continue if number matches

    No problem. Happy to help

    BSB

+ 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. start a formula based on date and then continue through number of cells
    By chinaexcel in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 06-21-2019, 10:14 PM
  2. search 2 criteria and if it matches give me the number of matches
    By sxch12 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-14-2017, 03:16 PM
  3. [SOLVED] Spell number part 2 (continue previous thread) (Indonesian language)
    By muharom.habib in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-12-2017, 10:56 PM
  4. Replies: 7
    Last Post: 03-25-2013, 06:07 PM
  5. [SOLVED] Change input number to red in sheet1 when it matches number in sheet2
    By Kent Kelly in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-06-2012, 04:44 PM
  6. Copy and paste above row number and continue till end
    By MUNDHRA in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-17-2012, 05:01 AM
  7. Vlookup Finds First Number,Needs to Continue On the list
    By realniceguy5000 in forum Excel Formulas & Functions
    Replies: 22
    Last Post: 08-29-2011, 11:56 AM

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