+ Reply to Thread
Results 1 to 9 of 9

Finding an item

  1. #1
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,813

    Finding an item

    Hello,
    So I have this code to search or finding a data or item in my worksheet.
    But when I an item are not in the worksheet or workbook, it does not give me a message "No matches were found".

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,222

    Re: Finding an item

    When I run your code in my file, it works and I get a message when the text is not found. Can you attach a file where this fails?

    Also your indentation is a bit eccentric which makes it hard to read. Here is a revision, just for formatting.

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,813

    Re: Finding an item

    Great! Thank you.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,222

    Re: Finding an item

    You marked it solved, but did you find out what was wrong? You left me hanging

  5. #5
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,813

    Re: Finding an item

    Hi
    Oh sorry. I tried your code it seemed work for me. The only thing is if you try to search "Test" which is not in the workbook then it prompted "This is the end of your search. Click OK or CANCEL to End" then when I click "OK" that is when the "No matches were found for "test".

    I think its ok unless there is much better. Thank you

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2505
    Posts
    27,222

    Re: Finding an item

    That's odd because I didn't change your code. All I did was modify the spacing.

  7. #7
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,813

    Re: Finding an item

    Hi 6StringJazzer,
    Sorry.... I thought it was working but I noticed that it does the same problem.

    With this code when I search an item that it not on the list... the message box said "This is the end of your search. Clik OK or CANCEL" but it should say "no matches were found for """" & What & """"""

    which this already in the code.

    I think the message "This is the end of your search" is when the item is on the list.

    Please Login or Register  to view this content.

  8. #8
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,531

    Re: Finding an item

    How about this way ?
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  9. #9
    Forum Contributor
    Join Date
    10-16-2023
    Location
    Poland
    MS-Off Ver
    Excel 2019 32bit WIN10
    Posts
    142

    Re: Finding an item

    My suggestion:
    Please Login or Register  to view this content.
    Last edited by Tajan; 06-06-2025 at 01:53 PM.

+ 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. Finding duplicate item
    By RJ1969 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2021, 01:10 PM
  2. Finding last item in column for sorting
    By vonsworld in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-05-2020, 05:04 AM
  3. Finding an item that isn't matching.
    By kylpr in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-07-2017, 04:42 PM
  4. Formula help please - finding a last item/status
    By Looloo in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-20-2014, 03:31 PM
  5. Finding out which item has the most and the least cost
    By quantum231 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-02-2013, 11:29 AM
  6. Finding the first item in a subset
    By NumeroUno in forum Excel General
    Replies: 10
    Last Post: 06-17-2013, 09:08 AM
  7. Promblem with finding an item in a list
    By lorcanjc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-26-2005, 06:20 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