Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    List Box to select multiple columns (2003 sp2)

    Hi Again (having a real dizzy day)

    I have 4 columns in a worksheet called Zones, on another worksheet I have made a listbox using the control toolbox for the list range I have put Zones!$F$4:$I$215 but in my list box I get only the contents of F4:F215, am I doing something wrong or can a list box only show the contents of 1 column.

    TIA

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: List Box to select multiple columns (2003 sp2)

    You must set the ColumnCount property of the list box to 4 in the Properties window. Optionally, you can also specify the ColumnWidths property in the form of a semi-colon separated list. The default unit is points (72 points = 1 inch). Example:

    30; 36; 24; 42

  3. #3
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: List Box to select multiple columns (2003 sp2)

    Thanks again

    If I wanted to change the design slightly (for aseatic reasons) and have the contents of Zones columns G, H + I to show in 3 adjecent columns wjem a selection is made from the list box what would I need to do, I have tried, the list box is linked to B6. =VLOOKUP(B6,Zones!G4:G215) but I get the response 'to few arguements etc.' I trawled through some old examples from Woody's that I have and I noticed that many of these formulas end with a number and the word false although I do not know why this is, I have tried adding ,2,false) but now all I get is #n/a, any ideas please

    Cheers

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: List Box to select multiple columns (2003 sp2)

    <img src=/S/whisper.gif border=0 alt=whisper width=29 height=17>The value returned from the listbox comes from column F, so that needs to be included in the lookup range:
    <code>=VLOOKUP(B6,Zones!$F$4:$I$215,2,FALSE)</code>
    and so on.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: List Box to select multiple columns (2003 sp2)

    Yep, thanks. I will edit my reply. <img src=/S/blush.gif border=0 alt=blush width=15 height=15>

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: List Box to select multiple columns (2003 sp2)

    Edited by HansV - thanks to Rory for pointing out the error in the original version.

    In the first place, the range should include all columns you need, including the lookup column, so here Zones!$F$4:$I$215.
    The third argument is the index (number) of the column from which you want to return a value. So to return a value from column H, the 3rd column of F4:I215, you'd use 3.
    The fourth argument specifies whether you want a "fuzzy" lookup. If you use TRUE or omit this argument, the lookup is fuzzy, if you use FALSE, Excel looks for an exact match.

    So:

    =VLOOKUP(B6,Zones!$F$4:$I$215,3,FALSE)

    to return a value from column H.

Posting Permissions

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