+ Reply to Thread
Results 1 to 11 of 11

Combo box on a user form

  1. #1
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Combo box on a user form

    Hello and thank you in advance

    I am using Office 2016 and I need help. I've already got this set up as below in an Excel sheet where the user goes to cell H4, clicks the drop down, and selects a company and the cells in I4, J4, K4, and L4 fill as appropriate. Now I want to hide all of this, move it to a user form with a combo box and I haven't done this before. Here is the user form and here is the code. Lastly I've attached the sheet

    I'm getting an error message that I dont know how to fix. What am I missing?

    Thanks for any help
    Attached Images Attached Images
    Attached Files Attached Files

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

    Re: Combo box on a user form

    You have not got a sheet named "Backups" with a combobox named ComboBox1 on it.
    As it does not exist the code errors out.
    Torachan,

    Mission statement; Promote the use of Tables, Outlaw the use of 'merged cells' and 'RowSource'.

  3. #3
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Re: Combo box on a user form

    Thank you Torachan,

    I do have a sheet called "Backups" and the combo box is on the user form which I plan to place on that sheet. How do I fix it?

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,820

    Re: Combo box on a user form

    In the ComboBox1 properties, you have manually entered a RowSource range. Delete that range in the RowSource property and try this macro:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  5. #5
    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: Combo box on a user form

    Hi,

    Does the attached help get you started.

    Click the Open Form blue button
    Attached Files Attached Files
    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.

  6. #6
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Re: Combo box on a user form

    Thank you Richard!

    I planned to figure out the combo box first and then move on to each of the text boxes but you did it all and it works beautifully! Thank you!

    My only question is that I have a line in Private Sub UserForm_Activate() which says .SelText = "Select". I thought this would insert "Select" at the top of the combo box drop down and I'm not seeing it. Any ideas?

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

    Re: Combo box on a user form

    Give the attached file and code a trial to see if this is what you want.
    I have change some of your textboxes to labels as they are just static.

    Please Login or Register  to view this content.
    Attached Files Attached Files

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

    Re: Combo box on a user form

    My only question is that I have a line in Private Sub UserForm_Activate() which says .SelText = "Select". I thought this would insert "Select" at the top of the combo box drop down and I'm not seeing it. Any ideas?
    I do not really encourage it as it is unnecessary, however if you put the word 'Select' in the ComboBox1 properties 'Text' property box it will show (no double apostrophes needed).
    With .SelText you are confusing on sheet control with UserForm controls.

  9. #9
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Re: Combo box on a user form

    Hello Richard, I am having a tough time moving the pieces you helped create back into the original spreadsheet. I made a scaled down version of the original. What's the best way to get your stuff back into the original? Im not a programmer

  10. #10
    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: Combo box on a user form

    What I'd do is use the ComboBox Text Propery and add the word "Select"
    Then a single line of code in the Backups Userform Activate event

    Me.Combobox1.List = Application.Transpose(Range("lst_customers"))

    Just seen your latest post.
    Have you created the dynamic range name "lst_customers"

    Then do you have the following Change event for the ComboBox (i.e. as before)

    Please Login or Register  to view this content.
    Last edited by Richard Buttrey; 12-19-2021 at 01:33 PM.

  11. #11
    Registered User
    Join Date
    08-25-2017
    Location
    Phoenix, AZ
    MS-Off Ver
    2013
    Posts
    74

    Re: Combo box on a user form

    Thank you once again Richard. The user form is working but I have one last remaining issue that isn't working.
    1. I have this code to show the user form when the user goes to the backups sheet (it's on Module 1 as you have it) but it doesn't appear when I go to the Backups sheet.
    Sub LoadBackups()
    Backups.Show
    End Sub

    What am I missing?

+ 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. Populate text boxes on user form, from combo box on same user form
    By Richardswaim in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 07-03-2016, 09:35 AM
  2. [SOLVED] Combo box in a user form
    By fazthfc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-01-2015, 10:25 AM
  3. User form combo box
    By slickz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-24-2014, 09:02 AM
  4. combo box user form code for two combo boxes
    By robert.begley1 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-01-2012, 02:25 PM
  5. combo box user form
    By robert.begley1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-28-2012, 03:38 PM
  6. [SOLVED] combo box in a user form
    By juliejg1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-10-2006, 04:20 PM
  7. Can't seem to get Combo Box on User Form
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-25-2005, 07:06 AM

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