+ Reply to Thread
Results 1 to 28 of 28

UserForm DropDown Menus

  1. #1
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    UserForm DropDown Menus

    Hi again.

    I was just wondering if it's possible to make a DropDown menu in a UserFrom too take info from a help sheet.

    So I could choose a suplier from a dropdown menu in the UserForm.

    And the DropDown menu would take make a dropdown menu from Sheet2 Cells A:A but would not include the empty ones.

    Can anyone help?
    Last edited by stojko89; 11-16-2011 at 08:17 AM.

  2. #2
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    Ok so I know I have to use the ComboBox but I don't know what code to put inside so it would display the range A on sheet2 and skip the empty onse. Thats what I need help with please.

  3. #3
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: UserForm DropDown Menus

    Hi stojko89
    one of many ways
    Please Login or Register  to view this content.
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  4. #4
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: UserForm DropDown Menus

    you could also try a scripting dictionary. This will read a column, delete duplicates as it says it's already in the dictionary.

    starts naming where your sheets located, the sheet it's reading from, cell range 2,1 just change to the corresponding column your on

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    Oh...so it's that complex eh? Ok I'll try them and tell how it goes.

    Thank you for the help.

  6. #6
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: UserForm DropDown Menus

    if your stuck upload a sample worksheet and I'll put in place one for you.

  7. #7
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    No it's ok, I want to make it work on my own if I'll have any problems then I'll ask for help, I just that I don't understand these 2 codes, usely I do but hey I have to learn somehow. Give me 1hr I'm working on something else also in excel but will get to this soon and I'll tell if it works like I mean or not
    But thank you very much for the help and for the offer

  8. #8
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: UserForm DropDown Menus

    sum up mine is it reads your A:A column and inputs whatever is in their to a "dictionary" so it wont put data twice as once it's added to the dictionary it will only display it once.

    (.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlUp))
    position two cells down/1 accross in column 1 in A so it Starts from "A2"

  9. #9
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    kieranbop:

    What do I have to do with this? Enter where my workbook is located at or leave it?:

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    I don't get this part... why would I want to open the same workbook again?

  11. #11
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    pike your code works great my only problem is I don't know where I could put in that it starts with range A1 yes but on a diferent sheet not the sheet I'm on?

  12. #12
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: UserForm DropDown Menus

    oh sorry I thought you was reading from a different workbook, if your reading from current workbook then just activeworkbook.active instead then still name the sheet to look at.

  13. #13
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: UserForm DropDown Menus

    or using Excel's builtin facilities:

    Please Login or Register  to view this content.



  14. #14
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    Please Login or Register  to view this content.
    I can't get it to work... am I doing something wrong again, did I not enter the data correctly?

  15. #15
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    Please Login or Register  to view this content.
    Doesn't work.

  16. #16
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: UserForm DropDown Menus

    cboAnalysis is the name of the combobox, is your combo box called cboAnalysis? and I thought it should be reading from "Sheet2" not "UserFormInfo"

  17. #17
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    Quote Originally Posted by kieranbop View Post
    cboAnalysis is the name of the combobox, is your combo box called cboAnalysis? and I thought it should be reading from "Sheet2" not "UserFormInfo"
    I changed the combobox name to cboDobavitelj like it should be and the name of the sheet that it should be taking data of it is named UserFormInfo I just renamed it

    Please Login or Register  to view this content.
    Here is how I'm using it.
    And the error is Runtime error 1004
    and it says something about the order of the filtering is not vaild and that the first row should not be empty or should not have the same name? I don't know what the error's about.

  18. #18
    Forum Contributor
    Join Date
    09-08-2011
    Location
    Leicester, England
    MS-Off Ver
    Excel 2007
    Posts
    157

    Re: UserForm DropDown Menus

    so is mine working now or not? if not upload your workbook

  19. #19
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: UserForm DropDown Menus

    Please Login or Register  to view this content.

  20. #20
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    snb. Now it works! Super Thank you very much, all of you.
    kieranbop I couldn't get yours to work. I don't know why. If you want you can still try to take a look why it didn't work, I'll upload my workbook.
    pike - I didn't know how or where to add the sheet it your code but it would have worked good.

    Thank you very much for your help!
    Attached Files Attached Files

  21. #21
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    Ok so snb looks like the code expired or something I don't know

    It doesn't even let me open the UserForm...

    Help again please.

    Also can I not have to Inicilize codec in there? for 2 different dropdowns in the same UserForm?

    Many thanks.

    I've Uploaded the file so if one will take a look you will see the error.
    Attached Files Attached Files

  22. #22
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: UserForm DropDown Menus

    Never use merged cells while using VBA. VBA doesn't like them. So remove them in the worksheet.

    PS. I wish I knew a method to letting expire VBA-code....

  23. #23
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    So I changed the merged cells in to seperate cells and recopyed the code in to VBA and it's still not working It shows me like I have a problem with the name of the table. Cuse when I hit debug it goes it colors
    Please Login or Register  to view this content.
    But when I don't have your code in the VBA it works fine. But then I'm withouth the code :/

    And I was just joking about the expire part

  24. #24
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: UserForm DropDown Menus

    check the names for typos.
    Attached Files Attached Files

  25. #25
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    @snb

    I don't know what wrong anymore.
    You gave me back my workbook where the code works, and I copyed the same code as you put it in the Narocila snb. And when I do the UserForm doesn't show up anymore but I get an error. When I take the code out again then the UserForm shows back up. It worked once and I didn't change a thing and it stoped working. whats up with that?

  26. #26
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: UserForm DropDown Menus

    Check the userform's name and how it is called/started.

  27. #27
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    sorry for not replyn so long.

    Everything is named right. And when I call the UserForm it comes up if it doesn't have the Initialize code.
    But I was checking the properties of ComboBox and I saw I can enter there witch range I want it to refer to. And it work, Now my only problem is that it counts the empty ones couse I set the Range A3:A250 And I didn't have to enter the code to make it happen. So is it possible to somehow enter that it lefts out the empty ones?

  28. #28
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: UserForm DropDown Menus

    This continues here:

    http://www.excelforum.com/excel-prog...-userform.html

    So this one is solved.

+ 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