+ Reply to Thread
Results 1 to 5 of 5

How to create, customize, populate and set focus to a combobox

  1. #1
    Registered User
    Join Date
    03-25-2004
    Posts
    54

    How to create, customize, populate and set focus to a combobox

    Hey, guys.

    What's up?

    I've been searching for a way to create a dropdown combobox with VBA, exaclty the way I want it, but I haven't found anything similar to what I want.

    I need to do this...

    1) Unhide column A (if it is hidden, of course).

    I know how to do this.

    Please Login or Register  to view this content.
    2) Create a combobox (dropdown list) and name it "cbbActionCombo".

    I have no idea on how to do this, although I've searched a little about it. I know there are two kinds of comboboxes (UserForm and ActiveX), but I do not know which is better/suitable to my needs. This combobox must be customizable, I mean, I want it to have transparent background and no borders; and, mainly, I need to change its font style. That's the reason I quit on using data validation dropdown list. It's not customizable.

    3) Once I have a combobox created and named, I need to put it exactly "inside", so to speak, cell A10.

    I know how to do this. Well, sort of...

    Please Login or Register  to view this content.
    4) Next step is to populate the combobox with a named range (dynamic range) called "rngActionComboList". By the way, this named range already exists; there's no need to create it. Just one detail... This named range may vary depending on which button I'll click, on the sheet, but that's OK. If I learn how to populate the combobox with one named range, I can deal with the other ones, no problem.

    I don't know how to do that.

    5) With the combobox created, named, sized, positioned and populated, I want it to receive focus and drop down, showing the list with the first item highlighted.

    I don't know how to do that.

    Well, that's it. From that point on, I know what to do when something is selected and bla bla bla.

    After some item is selected from the list, a macro will be run. One of the first things this macro will do is...

    6) Delete that combobox and hide column A. If deleting is just a matter of "cbbActionCombo.Delete", I'm cool with that. If not, please, guide me.

    That's it, folks. I'm pretty sure the coding for all this stuff must be relatively simple; but for me, a newbie, it is not. I hope you can help me.

    Just for the record, I know how to do everything I mentioned above... with the power of my MOUSE. lol Problem is, when it comes to VBA...Oh, I suffer! lol I tried to record macros while doing all that stuff, but some things just won't get recorded; I don't know why. So, I got stuck.

    Thanks in advance for your time, guys.

    brunces

  2. #2
    Registered User
    Join Date
    03-25-2004
    Posts
    54

    Re: How to create, customize, populate and set focus to a combobox

    Hey, guys.

    This is what I've been struggling with so far...

    Please Login or Register  to view this content.
    And I haven't figured out how to change the color and size of the font inside the combobox. How do I do that?

    Thank you for your time, guys. I really appreciate it.

    brunces
    Last edited by brunces; 04-21-2016 at 09:00 AM.

  3. #3
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    973

    Re: How to create, customize, populate and set focus to a combobox

    I found this amazing combobox example:
    http://boisgontierjacques.free.fr/fi...veComboBox.xls
    The site is:
    http://boisgontierjacques.free.fr/

    And this is my attempt to modify the code (from the link above) that may suit to your need:
    Please Login or Register  to view this content.
    The workbook:

    So basically the combo will only appear when you select certain cell (e.g A10).

  4. #4
    Registered User
    Join Date
    03-25-2004
    Posts
    54

    Re: How to create, customize, populate and set focus to a combobox

    That's a very good code, Akuini. Thank you very much for your time.

  5. #5
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    973

    Re: How to create, customize, populate and set focus to a combobox

    Quote Originally Posted by brunces View Post
    That's a very good code, Akuini. Thank you very much for your time.
    You're welcome & thanks for the reply.

+ 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] Code required to Auto Populate 3rd Combobox based on 02nd Combobox Selection
    By bimmy80 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-14-2015, 03:56 AM
  2. [SOLVED] can not use set.focus to return to combobox (exit by val)
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-30-2013, 07:47 AM
  3. [SOLVED] Excel Userform: Populate other controls (i.e. textbox & combobox) based on combobox select
    By MileHigh_PhD in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 04:50 PM
  4. [SOLVED] ComboBox Search and focus on cell
    By adam2308 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-31-2012, 05:46 PM
  5. [SOLVED] Which combobox has the focus?
    By Daniel Bonallack in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-31-2006, 09:25 PM
  6. [SOLVED] Focus after combobox
    By Ed in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-27-2005, 09:05 AM
  7. OLE Combobox: Excel breaks down when it has focus
    By deathyam@yahoo.com in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-29-2005, 06: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