+ Reply to Thread
Results 1 to 4 of 4

message box showing # of values found with a searchbox macro

  1. #1
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    469

    message box showing # of values found with a searchbox macro

    Hi peeps,

    I have the following macro which is basically a search box. If the value/text is found anywhere in the workbook the cell is highlighted in yellow.

    I'm hoping to expand on this by adding a msgbox which lets the user know how many cells were found and highlighted eg. "3 entries found"

    any help from the experts?

    Please Login or Register  to view this content.
    Last edited by Gti182; 11-26-2010 at 10:59 AM.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: message box showing # of values found with a searchbox macro

    Hi,

    Add another variable to count the number of times the Else part of the loop is processed. i.e.
    Dim lCounter as Long

    Then within your Else part of the loop use the line
    lCounter = lCounter + 1

    Then your message box becomes

    MsgBox lCounter & " entries found"


    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: message box showing # of values found with a searchbox macro

    Try this:
    Please Login or Register  to view this content.
    Not all forums are the same - seek and you shall find

  4. #4
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    469

    Re: message box showing # of values found with a searchbox macro

    Cheers guys!

    Simon Lloyd your solution is better than i visualised

+ 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