Selec the column to add in a listbox

G

Guest

I have a list in a sheet with 20 columns and a use a listbox to check the
datas in this list, for exemple:
A B C D E
F....
Numb Name Tel state code e-mail Validation code

when i want check all the datas, i use the code below to add all the column
in the listbox
ListBox1.ColumnCount = 20
ListBox1.RowSource = "A4:T200"

But sometimes I need check just the datas in some columns, so what i want to
do is insert a commandButton that when the user press this buttom just apears
in the listbox the columns B, D and F. is it possible?

please someone can help?
thanks
 
J

Juan Pablo González

Ana Paula,

I think the easiest solution would be to play with the ColumnWidths
property. You can still load the entire database into the ListBox, but you
can just hide the columns that you don't want. For example, in a 3 column
listbox, doing this:

ListBox1.ColumnWidths = "0;;"

will hide the first column and set the widths of the remaining 2 to
automatic width.

This:

ListBox1.ColumnWidths = "100; 0;"

will set the width of the first column to 100 points, hide the second column
and the third one will use whatever room there is left.

Hope this makes sense.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top