+ Reply to Thread
Results 1 to 10 of 10

Search Function Using Input Textbox

  1. #1
    Registered User
    Join Date
    08-04-2008
    Location
    coventry
    Posts
    8

    Search Function Using Input Textbox

    Hi Guys.

    At the moment, I have a search spreadsheet where I click a button, and an input box appears where I put a car reg in, and it searches a different sheet, returning results on the row the reg belongs in.

    I've had a slight change in spec. I now need the same function to work, but instead of an input box.. I want the user to type the reg in a text box that is already on the sheet, and then click a search button to retrieve the results.

    Is there anyway to easily amend the following code to get there?


    Please Login or Register  to view this content.
    Thanks in advance!!
    Last edited by tommib; 05-20-2009 at 11:28 AM.

  2. #2
    Registered User
    Join Date
    08-04-2008
    Location
    coventry
    Posts
    8

    Re: Changing my Search Spreadsheet

    Can anyone help?

  3. #3
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388

    Re: Search Function Using Input Textbox

    Replace varRegID with TextBox1 (or whatever it is called) in the line where you find the data.

  4. #4
    Registered User
    Join Date
    08-04-2008
    Location
    coventry
    Posts
    8

    Re: Search Function Using Input Textbox

    That didnt work TJ.. it doesnt do anything?

  5. #5
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388

    Re: Search Function Using Input Textbox

    ok try the following. I've made a few amendments to your code, using Range objects instead of Selection. You will have to change any worksheet names and commandbutton names as required.

    The code copies data to the same row (16) each time so overwrites existing data, I don't know if that is what you want, but your old code appears to do this.

    There are 2 examples of a search, one using a textbox and one using an inputbox.

    Place in a worksheet module:
    Please Login or Register  to view this content.
    Place in a code module:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    08-04-2008
    Location
    coventry
    Posts
    8

    Re: Search Function Using Input Textbox

    Thats brilliant! It works a treat thank you so much!

    Is it possible to have the retrieved data placed on different rows instead of just row 16?

    For example..

    Search range - result range

    B2 in C9

    B3 in C11

    B4 in C13

    Hope this makes sense!

  7. #7
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388

    Re: Search Function Using Input Textbox

    I think I got it, if not you may have to adjust the numbers (in the Set RangeToCopy line) to get the block of cells you want to copy.

    Comment out this line in the code above,
    Please Login or Register  to view this content.
    and insert these lines in the same place.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-04-2008
    Location
    coventry
    Posts
    8

    Re: Search Function Using Input Textbox

    That didnt seem to work.

    It ended up putting the whole row on Row105!.

    I've attached the sheet.. hopefully it will be easier to understand where I want the data.

    Thank you so much once again!!
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388

    Re: Search Function Using Input Textbox

    Sorry, I misunderstood what you wanted, the workbook has helped a lot.
    Please replace the whole of Sub FindReg with the following code:
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-21-2009
    Location
    Puyallup, WA
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Search Function Using Input Textbox

    Man, that code is incredible. I have a question in the worksheet 1. How do you put a text box within a cell like that? Also, how do you put the button to the right like that? Thanks. I wish I had skills like that.

+ 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