+ Reply to Thread
Results 1 to 5 of 5

Userform Combobox to populate form: Can I change the order of the columns in the combobox?

  1. #1
    Registered User
    Join Date
    09-17-2014
    Location
    Wisconsin, USA
    MS-Off Ver
    2010
    Posts
    5

    Question Userform Combobox to populate form: Can I change the order of the columns in the combobox?

    I put together a solidly working userform that uses data from the worksheet to populate the combobox that would then select the record with which to populate the userform. I was using a named range (also defined in VBA) to do this. However, I now want to use different columns to select from, and I can't seem to get the named range to organize the rows how I want. What I want is column "i" to be the first choice, with column "c" as the second criteria (previous, I used b and c). I have set up the named range to run from c to i, and then set column width for everything NOT "c" or "i" to zero. But how do I make "i" show first? Or is this something named ranges cannot do?

    Please Login or Register  to view this content.
    This is literally my LAST punchlist item to close out this project, so the help would be greatly appreciated!

  2. #2
    Forum Guru
    Join Date
    10-03-2014
    Location
    Indonesia
    MS-Off Ver
    2003
    Posts
    2,877

    Re: Userform Combobox to populate form: Can I change the order of the columns in the combo

    Hi,

    .RowSource property expect continous range with formal range syntax, which means the range must be started from top left to bottom right cell, no way you can switch this.

    However you can use .List property and set a matrix to this property.

    Your code will be like this :

    Please Login or Register  to view this content.

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Userform Combobox to populate form: Can I change the order of the columns in the combo

    If you only want columns 1 and 9, you can also use something like this:
    Please Login or Register  to view this content.
    Remember what the dormouse said
    Feed your head

  4. #4
    Registered User
    Join Date
    09-17-2014
    Location
    Wisconsin, USA
    MS-Off Ver
    2010
    Posts
    5

    Re: Userform Combobox to populate form: Can I change the order of the columns in the combo

    I went with romperstomp's solution. With a little tweaking, it worked like a charm. Thanks!

    Craig W.

  5. #5
    Registered User
    Join Date
    09-17-2014
    Location
    Wisconsin, USA
    MS-Off Ver
    2010
    Posts
    5

    Re: Userform Combobox to populate form: Can I change the order of the columns in the combo

    Okay, one more need here... Can I get the Combobox list to sort alphabetically? I've been looking through various forums and trying variations on those solutions, but cannot seem to get where I need to be. Here is the code as it stands, which only sorts in the order on the originating sheet. This is so much simpler using anything other than Excel... But it's what the client wants. (Sorry, had to vent a bit there!)

    Basically, I need the sort to be ascending alpha by column 7. Bonus if I can sort by 7, then by 1 without adding too much more code. But since most rows on the sheet will not have more than 3-4 rows per Column 7 (a name field), it's not that vital. Thanks again...



    Please Login or Register  to view this content.

+ 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. Userform Combobox to populate based on selection in another combobox
    By Excelnoub in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-14-2014, 03:34 PM
  2. [SOLVED] Userform combobox to populate RowSource for new values in combobox
    By Stratfordoaks in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-17-2013, 01:18 PM
  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. Calling a user form initialize sub when entering the form to populate combobox...
    By regupnorth in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-02-2012, 07:24 AM
  5. transferring combobox value from one user form to populate combobox on another
    By smartphreak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-05-2010, 10:12 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