+ Reply to Thread
Results 1 to 7 of 7

when lookup value does not found then exit sub

  1. #1
    Forum Contributor
    Join Date
    07-13-2015
    Location
    Poland
    MS-Off Ver
    MS Office 365
    Posts
    174

    when lookup value does not found then exit sub

    Please Login or Register  to view this content.
    how to display msgbox and exit sub if lookup_value (cells(1,1)) does not exist in my data_description.Range
    ?

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,958

    Re: when lookup value does not found then exit sub

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: when lookup value does not found then exit sub

    Perhaps.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: when lookup value does not found then exit sub

    Quote Originally Posted by Bernie Deitrick View Post
    Please Login or Register  to view this content.
    You could replace the Vlookup with this...

    name = data_descriptions.Cells(name, 5).Value
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Forum Contributor
    Join Date
    07-13-2015
    Location
    Poland
    MS-Off Ver
    MS Office 365
    Posts
    174

    Re: when lookup value does not found then exit sub

    Hi,

    In all your samples I have run-time error '424' in line:
    Please Login or Register  to view this content.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: when lookup value does not found then exit sub

    What is data_descriptions.Range supposed to refer to?

    If you drop .Range from that does the code work?

  7. #7
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,958

    Re: when lookup value does not found then exit sub

    It may be a problem with data_descriptions

    Here was the code that I used to test

    Please Login or Register  to view this content.

+ 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. Textbox exit event prevents to exit userform
    By smjjvh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2014, 06:08 AM
  2. [SOLVED] Search for value and exit macro if found
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-08-2014, 09:38 PM
  3. [SOLVED] How to Stop & Exit Sub if cell value > 1 was found
    By tuongtu3 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-20-2013, 01:41 AM
  4. [SOLVED] If duplicate is found in column B, delete Row, if not, msgbox and exit
    By VBA FTW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2013, 11:34 AM
  5. [SOLVED] Compare two folder files - whether they exit or not and if exit then copy to another foler
    By sthiru in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-10-2012, 12:08 AM
  6. How to exit a loop once the value is found in the range
    By Suety in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-28-2010, 01:30 PM
  7. Exit Sub if file/path not found
    By EMoe in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-16-2006, 06:55 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