+ Reply to Thread
Results 1 to 6 of 6

userform search button not working

  1. #1
    Registered User
    Join Date
    09-15-2020
    Location
    thimphu
    MS-Off Ver
    ms office 16
    Posts
    2

    Post userform search button not working

    I used the following code to search data in my userform. I want to populate the data in rest of the textboxes by filling data in one of the textboxes. However the code doesnt run and gives ( runtime error "13" type mismatch)

    Please Login or Register  to view this content.
    i would appreciate if someone could help me with this
    Last edited by davesexcel; 09-15-2020 at 10:39 AM.

  2. #2
    Forum Expert torachan's Avatar
    Join Date
    12-27-2012
    Location
    market harborough, england
    MS-Off Ver
    Excel 2010
    Posts
    4,302

    Re: userform search button not working

    see large yellow banner - how to upload your work book.
    otherwise crystal ball gazing

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,705

    Re: userform search button not working

    When asking for help about a code error message, always indicate which line of code has the error.

    I do not see anything obvious in this code that is causing that error. Please see the yellow banner at the top of the page and attach your file for further diagnosis.

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: userform search button not working

    Using textbox_change will cause an error if you are searching for more than 1 character in the search box.

    If you just want one value to search for, maybe this would work.

    Please Login or Register  to view this content.
    If you need to search for more than 1 character, find() may be a better way.

    I made the sample to fit my userform, you will have to fix it to suite yours.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,176

    Re: userform search button not working

    I am guessing you are getting type mismatch as the value cannot be found...
    Integer cannot hold error...
    Try this...

    Please Login or Register  to view this content.
    Last edited by sintek; 09-15-2020 at 02:32 PM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

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

    Re: userform search button not working

    This won't cause a compiler error but you have another problem here. This Sub responds to a change in TextBox6, and it also causes a change in TextBox6, which will send you into an infinite loop.

    Please Login or Register  to view this content.
    You will have to add code to prevent that.

+ 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. [SOLVED] VBA UserForm Search Button
    By pumashoes in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-03-2021, 03:54 PM
  2. Userform Search Button and number manipulation.
    By Ph0enix in forum Excel General
    Replies: 1
    Last Post: 05-25-2015, 05:00 AM
  3. [SOLVED] userform search button remove search only when i type
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-08-2014, 02:32 AM
  4. [SOLVED] userform search code not working
    By vickyp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-16-2013, 02:33 PM
  5. [SOLVED] Search button on an USERFORM
    By alopecito in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2012, 09:34 AM
  6. [SOLVED] Search button in userform
    By Ray316 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-07-2011, 09:10 AM
  7. Search Button On Userform
    By markrennolds in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-03-2010, 04:06 PM

Tags for this Thread

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