+ Reply to Thread
Results 1 to 8 of 8

Userform - Find Command Breaking a ComboBox

  1. #1
    Registered User
    Join Date
    04-29-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    33

    Userform - Find Command Breaking a ComboBox

    I currently have two userforms on my spreadsheet, one for inputting data (input form) and one of editing data (update form)
    The first of which is working fine for the moment, the second is almost working.

    The problem I am having with my second userform, the update form, is a combobox that is breaking when a search/find is used to bring up existing data.
    I have a contract number that I use to search for the entry and then populate the following 3 boxes (two text boxes, which work fine and the combobox which breaks).
    Once I enter my contract number and press my 'find' button, it brings up the correct data, which is great. Unfortunately it then wont let me update the combobox as it is removing the options.
    It works fine if you don't use the find function, you can use the combobox to select "Yes" "No" or "N/A". Once you use the find button it removes those three options so you can't change and update the sheet as it's supposed to.

    I am unable to figure out which part of the code I am using is breaking this or what code I am missing to fix this.

    The Combobox that is breaking:
    Please Login or Register  to view this content.
    The Find button that seems to be breaking it:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Userform - Find Command Breaking a ComboBox

    I suspect:-

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Is this function slow?

    You should be using the find function. Not looping through every cell in column A.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Userform - Find Command Breaking a ComboBox

    I suspect:-

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    Is this function slow?

    You should be using the find function. Not looping through every cell in column A.

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-29-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    33

    Re: Userform - Find Command Breaking a ComboBox

    The function isn't slow, though as is probably obvious I am new to vba and I'm sure the code I have is messy and inefficient.

    I tried changing the .text to .value and it seemed to make no difference.

    The odd thing is about my problem is that it works just fine if I don't use the 'find' button to bring up the other information, if I type everything in anew it works perfectly. So I'm pretty sure it is something wrong with my find button.

    If I'm honest I'm not too sure what to do with that bit of code you've given me or what it quite does/should replace. I'm guessing it's a better replacement for my find function or part of it at least. I don't suppose you could give me a bit of clarity? Your help is very much appreciated.

  5. #5
    Registered User
    Join Date
    04-29-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    33

    Re: Userform - Find Command Breaking a ComboBox

    Any updates on this would be greatly received, even if it means changing how my find function works.

  6. #6
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Userform - Find Command Breaking a ComboBox

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  7. #7
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,438

    Re: Userform - Find Command Breaking a ComboBox

    Load the combobox on initialize of userform.

    Please Login or Register  to view this content.
    also remove the .clear of control when the Clear button is pressed.
    Cheers
    Andy
    www.andypope.info

  8. #8
    Registered User
    Join Date
    04-29-2015
    Location
    UK
    MS-Off Ver
    2010
    Posts
    33

    Re: Userform - Find Command Breaking a ComboBox

    Mehmetcik, I thought I had attached the file, unless I have done it wrong or attached far too much? If that's the case let me know so as next time I can do it correctly! Luckily there should be no sensitive data on the file as I test all sheets with made up non-sense to make sure they work long before they're put into actual use. But thank you very much for all your time and effort, I promise you it's appreciated.

    Andy Pope, It's the end of the day and I only just got back to my desk to see this but... I tested that change in the code and it works wonderfully! Not only that but this will fix a minor problem I was having elsewhere on this sheet and also on another sheet! This is such a life saver and will clean up so much excess code, I honestly can't thank you enough for this fix! First thing Monday morning I will be sticking code similar to this in several places.

+ 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] when command button in userform is pressed.. look to find multiple entries
    By Jenkins27 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-01-2015, 03:15 AM
  2. VBA code to find and delete cell contents based on userform combobox selections
    By anfdrew in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-06-2013, 04:13 PM
  3. [SOLVED] Based on userform combobox selection find text on worksheet
    By afpPaul in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-26-2012, 08:07 AM
  4. Find UserForm ComboBox Value (date) & Transfer TextBox Data To Same Row
    By okriskao in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-30-2008, 11:33 AM
  5. [SOLVED] command for breaking link in excel is not seen.
    By suresh in forum Excel General
    Replies: 1
    Last Post: 01-09-2005, 11:06 PM

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