+ Reply to Thread
Results 1 to 6 of 6

Search button in userform

  1. #1
    Registered User
    Join Date
    05-16-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    19

    Search button in userform

    Hi, this is the first time I create a userform. So bare with me plz.

    I have a command button called "search".
    What I am trying to make it do: when the user types a word in textbox1 and then he clicks the search button. It will search for that word in column A to BA.
    If he doesn’t find the searched word --> a message will appear in textboxe2 "no results found".
    If there is a result --> it will copy the cells in texteboxe2. (The word can be found in multiple cells) EX: A50, A52, A70, D20, D30, D60, V45, V53 and V90

    The result should look like this:

    A1<-- the first cell of the column must appear before the result in that column.
    A50
    A52
    A70

    D1
    D20
    D30
    D60

    V1
    V45
    V53
    V90

    So far, I got this code and I am stuck:
    Please Login or Register  to view this content.
    Thank you for the big help.
    Last edited by Ray316; 07-07-2011 at 09:11 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: Search button in userform

    Do you mean Column BA or B, your code seems to use Columns A to B?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    re: Search button in userform

    Not sure if this is what you want.

    Use a ListBox instead of the TextBox
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    05-16-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Search button in userform

    Hi Roy,
    The range is from columns A to BA.

    Thank you for the help. In general, is exactly what I want.

    I tried what you gaved me on my tester, and there is few pointer.
    First, the clear button doesn't work anymore on the result box. Is that because you change it to a list box?

    Second, when I get the results, it start with a weird symbol (Ex: $P$2)
    I don`t know why it does that.

    basicly, before every correct result (in listbox), I want him to give the value found in the first cell of the same column where the result was found.
    I hope that is clearer.

    P.s. I am sorry for the confusion, I am trying to be as précise as I can be.

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Search button in userform

    I've made some amendments
    Please Login or Register  to view this content.
    I had set the code to list the address of the cell containing the word, $P$2
    The clear code simply needed to include the ListBox

  6. #6
    Registered User
    Join Date
    05-16-2011
    Location
    montreal
    MS-Off Ver
    Excel 2003
    Posts
    19

    Re: Search button in userform

    Hey Roy,
    I tested and it works!!!!.
    Thank you for the help. I really appreciate it.

+ 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