Consulting

Results 1 to 9 of 9

Thread: multi-column list box

  1. #1
    VBAX Regular MUSASHI's Avatar
    Joined
    Oct 2004
    Location
    Corpus Christi, Texas (Very South)
    Posts
    44

    multi-column list box

    I have a userform with a list box. I have a named range (3 columns),

    in userform properties, I set Bound Column to 1, column count to 3. I see the 3 columns from my range in the object view, yet when I run the userform, I only see the first column.... I see the header now, but only 1 column of data. Trying to do this from a range vs. an array..

    What the heck else....Im reading the stuff right out of JWalks book on Excel 2000....

    Thanks Mus

  2. #2
    VBAX Regular MUSASHI's Avatar
    Joined
    Oct 2004
    Location
    Corpus Christi, Texas (Very South)
    Posts
    44
    Private Sub UserForm_Initialize()
        LastRow = Range("A65536").End(xlUp).Row
        ListBox1.RowSource = "A3:A" & LastRow
    End Sub
    changed to this,,,duh
    Private Sub UserForm_Initialize()
        LastRow = Range("A65536").End(xlUp).Row
        ListBox1.RowSource = "A3:C" & LastRow
    End Sub
    2 hours later...lol
    Last edited by Aussiebear; 04-04-2023 at 01:16 AM. Reason: Adjusted the code tags

  3. #3
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Hi Musashi,

    Try this also

  4. #4
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Musashi,
    Inspired by John's combo, I spent a wet afternoon trying to make it more automated. Here's where it stands so far. Ideally, the userform will give a "click in columns" source for the combo, on completion. For the moment, change the Const values.
    MD
    http://www.geocities.com/mdmackillop/mytest.xls

  5. #5
    Administrator
    Chat VP VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Hi MD,

    This example shows both a combo and list box (selection is enabled for the list box only in the E.G.) this assumes that each item is on the same sheet and does not come from different sheets.

    I thought that the nature of multi-col list/combo boxes was that you couldn't select individual items in the different cols, if you can do this it makes the use of multi-cols much more flexible......

    John

  6. #6
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi John,
    What I meant was that the source data for the combo would be selected by clicking in a selection of columns, eg G; A; B or such like, and the bound column could be chosen by adding a number to a textbox. Something to play around with, maybe, but I'm not sure about practical end uses.
    MD
    Updated version http://www.geocities.com/mdmackillop/mytest.xls

  7. #7
    VBAX Regular MUSASHI's Avatar
    Joined
    Oct 2004
    Location
    Corpus Christi, Texas (Very South)
    Posts
    44
    thanks folks.

    What I am trying to accomplish is something that I know I have seen before but cant seem to find again.

    That is where I have multiple named ranges on a sheet. I want the names of ranges to show up in combobox....I got that part, additem method. But where I am struggling is when i make a selection in combobox, I want the data in my list box to change to the corresponding range.

    In my example, its based on training, I would have some medical things, some safety training, some 3rd Party training etc etc. My named ranges for each would contain the various possible items for each category of training.

    Ultimately, when i open this form, I select an employee, I select a training type from combo , then I select the multi items out of the list, click a cmdbutton and capture the record of the training. I have everything else but, the multiple potential ranges selected from a combo that will appear in listbx (lbTraining).

    Any ideas?

    Thanks (please no kicking)

  8. #8
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Musashi,
    Starter for ten (as we say here). http://www.geocities.com/mdmackillop/ComboList.xls
    MD

  9. #9
    VBAX Regular MUSASHI's Avatar
    Joined
    Oct 2004
    Location
    Corpus Christi, Texas (Very South)
    Posts
    44
    Man MD,

    that certainly does it, problem is, I dont know how yet...haha
    I owe ya a pint! The global sheet dealie....off to search that out...

    Thx a bunch (Muchas Gracias is how we say it down here in South Texas)


    Mus

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •