ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selec the column to add in a listbox (https://www.excelbanter.com/excel-programming/382441-selec-column-add-listbox.html)

Ana Paula

Selec the column to add in a listbox
 
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



Juan Pablo González

Selec the column to add in a listbox
 
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.

--
Regards,

Juan Pablo González

"Ana Paula" wrote in message
...
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






All times are GMT +1. The time now is 08:43 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com