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.
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.
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.
Great! Thank you.
You marked it solved, but did you find out what was wrong? You left me hanging![]()
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
That's odd because I didn't change your code. All I did was modify the spacing.
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.
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.
My suggestion:
![]()
Please Login or Register to view this content.
Last edited by Tajan; 06-06-2025 at 01:53 PM.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks