+ Reply to Thread
Results 1 to 2 of 2

Explanation on VBA code: Not {variable} Is Nothing

  1. #1
    Forum Contributor
    Join Date
    07-08-2015
    Location
    Indiana
    MS-Off Ver
    Excel 2007
    Posts
    128

    Explanation on VBA code: Not {variable} Is Nothing

    Hi Experts. This is a very basic question and I am looking just to ensure I am understanding what it is doing in code:

    Set searchresult = .Find(What:=lookingfor)

    if Not searchresult Is Nothing then
    msgbox "YES I FOUND IT"
    else
    msgbox "NOPE"
    end if

    if Not Searchresult is Nothing

    Is this an error catching of sorts so that after doing the search (.find) if it finds what im looking ( RETURNS A TRUE ) then will execute the steps of finding it

    if it does not find what I am searching for (RETURNS A FALSE) then will execute the else steps?

    In english does If Not... Is Nothing = a double negative and means it has what Im looking for?


    Thanks so much


    PS -->>> what kind of error is generated if I do a .Find and it does not find what Im searching for (and I do not have this Not is Nothing)?
    Last edited by scott micklo; 02-15-2018 at 08:25 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2406 (Windows 11 23H2 64-bit)
    Posts
    82,162

    Re: Explanation Please -----sorry : real basic question

    Please take a moment to re-read forum rule #1 and then amend your thread title to something that better explains your problem. Changing your thread title is not optional, which means you must change it. Thanks!

    • Use concise, accurate thread titles.
    • Your post title should describe your problem, not your anticipated solution.
    • Use terms appropriate to a Google search - poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice tell us nothing.
    • Responding to a request to change your thread title by doing so is mandatory.

    To change a title go to your first post, click EDIT then Go Advanced and change your title.

    No help to be offered, please, until the OP complies with this request.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

+ 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. [SOLVED] Real basic query on linked databases
    By yachrishere in forum Excel General
    Replies: 3
    Last Post: 07-26-2015, 09:50 PM
  2. REAL BASIC VBA syntax for retrieving results from query
    By drowe005 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2015, 03:51 PM
  3. Need help with a real basic VBA question
    By drowe005 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-07-2015, 01:38 AM
  4. a real simple question for you all!
    By bunnosaurusrex in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-19-2013, 12:50 AM
  5. Real time question
    By balerjoe in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-14-2008, 05:51 PM
  6. Question for the real experts!
    By diepenbos in forum Excel General
    Replies: 3
    Last Post: 03-16-2005, 12:06 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