+ Reply to Thread
Results 1 to 3 of 3

Finding value

  1. #1
    Forum Contributor
    Join Date
    05-04-2005
    Posts
    136

    Finding value

    I have a user form where the user enters a site number. in the spreadsheet i have a range names "ValidSites".
    After the user enters a site number and clicks on a button, i would like to validate that that site appears in the ValidSites list.

    onclick event()
    if txtSiteNumber is found in Range(ValidSites) then
    msgbox("found")
    else
    msgbox("notfound")
    endif
    endsub

    what would be the code for the if statement?

    thanks in advance

  2. #2
    Bernie Deitrick
    Guest

    Re: Finding value

    t,

    If Not IsError(Application.Match(txtSiteNumber, _
    Range("ValidSites"), False)) Then
    MsgBox ("Found")
    Else
    MsgBox ("Not found")
    End If

    HTH,
    Bernie
    MS Excel MVP


    "tkaplan" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I have a user form where the user enters a site number. in the
    > spreadsheet i have a range names "ValidSites".
    > After the user enters a site number and clicks on a button, i would
    > like to validate that that site appears in the ValidSites list.
    >
    > onclick event()
    > if txtSiteNumber is found in Range(ValidSites) then
    > msgbox("found")
    > else
    > msgbox("notfound")
    > endif
    > endsub
    >
    > what would be the code for the if statement?
    >
    > thanks in advance
    >
    >
    > --
    > tkaplan
    > ------------------------------------------------------------------------
    > tkaplan's Profile: http://www.excelforum.com/member.php...o&userid=22987
    > View this thread: http://www.excelforum.com/showthread...hreadid=478305
    >




  3. #3
    Forum Contributor
    Join Date
    05-04-2005
    Posts
    136
    can these cells be hidden while running this code? the sheet is visible but the columns that i am searching are hidden.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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