ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How Do I Add Column Headers to a ComboBox? (https://www.excelbanter.com/excel-programming/377642-how-do-i-add-column-headers-combobox.html)

[email protected]

How Do I Add Column Headers to a ComboBox?
 
How do I add text to the Header area of a 2-column ComboBox? I have the
ColumnHeads property set to True, which causes a blank, outlined header area
to display at the top of my drop-down list, but there's no property that I
can find that contains header text, nor can I find any mention of it in Help.
FYI, I'm loading the ComboBox from a 2D array using a statement like
ComboBoxAddress.Column() = AddressList.

Help says ComboBox data is stored in an array, with indexes starting at
(0,0). The first row in the array doesn't become the headers; if it did, my
header area would be populated with the first row of my data. I've tried
this statement: ComboBoxAddress.List(-1, 0) = "Used" (to populate the column
1 header with the text "Used") since "-1" is often used to signify a special
case and it would be logical since the header is one row before the first row
of data, which is row zero. That statement had no apparent effect.

JLGWhiz

How Do I Add Column Headers to a ComboBox?
 
Theoretically, the cell above your range that is used to populate the
comboBox is the ColumnHeader. I can't get it to work either.

" wrote:

How do I add text to the Header area of a 2-column ComboBox? I have the
ColumnHeads property set to True, which causes a blank, outlined header area
to display at the top of my drop-down list, but there's no property that I
can find that contains header text, nor can I find any mention of it in Help.
FYI, I'm loading the ComboBox from a 2D array using a statement like
ComboBoxAddress.Column() = AddressList.

Help says ComboBox data is stored in an array, with indexes starting at
(0,0). The first row in the array doesn't become the headers; if it did, my
header area would be populated with the first row of my data. I've tried
this statement: ComboBoxAddress.List(-1, 0) = "Used" (to populate the column
1 header with the text "Used") since "-1" is often used to signify a special
case and it would be logical since the header is one row before the first row
of data, which is row zero. That statement had no apparent effect.


JLGWhiz

How Do I Add Column Headers to a ComboBox?
 
I got it to work by listing my data in a column, pick any consecutive series,
C3:C10, with the proposed header in C2. In the Properties window, enter
c3:c10 in the Row Source box and set Column Heads to True. You can use any
range for your row source, If you want two columns then as an example set
c3:d10 as your row source and it will list these in your combo box as two
columns with eight rows and your header will be from C2 and D2 when you set
the column count property to 2.

The help instructions are not very clear, I had to play with it a while to
get it.

"JLGWhiz" wrote:

Theoretically, the cell above your range that is used to populate the
comboBox is the ColumnHeader. I can't get it to work either.

" wrote:

How do I add text to the Header area of a 2-column ComboBox? I have the
ColumnHeads property set to True, which causes a blank, outlined header area
to display at the top of my drop-down list, but there's no property that I
can find that contains header text, nor can I find any mention of it in Help.
FYI, I'm loading the ComboBox from a 2D array using a statement like
ComboBoxAddress.Column() = AddressList.

Help says ComboBox data is stored in an array, with indexes starting at
(0,0). The first row in the array doesn't become the headers; if it did, my
header area would be populated with the first row of my data. I've tried
this statement: ComboBoxAddress.List(-1, 0) = "Used" (to populate the column
1 header with the text "Used") since "-1" is often used to signify a special
case and it would be logical since the header is one row before the first row
of data, which is row zero. That statement had no apparent effect.


Tom Ogilvy

How Do I Add Column Headers to a ComboBox?
 
Just a hint: a quick google search for this group using the appropriate
terminology would have revealed the requirement and probably saved you some
time.

--
Regards,
Tom Ogilvy



"JLGWhiz" wrote in message
...
I got it to work by listing my data in a column, pick any consecutive
series,
C3:C10, with the proposed header in C2. In the Properties window, enter
c3:c10 in the Row Source box and set Column Heads to True. You can use
any
range for your row source, If you want two columns then as an example set
c3:d10 as your row source and it will list these in your combo box as two
columns with eight rows and your header will be from C2 and D2 when you
set
the column count property to 2.

The help instructions are not very clear, I had to play with it a while to
get it.

"JLGWhiz" wrote:

Theoretically, the cell above your range that is used to populate the
comboBox is the ColumnHeader. I can't get it to work either.

" wrote:

How do I add text to the Header area of a 2-column ComboBox? I have
the
ColumnHeads property set to True, which causes a blank, outlined header
area
to display at the top of my drop-down list, but there's no property
that I
can find that contains header text, nor can I find any mention of it in
Help.
FYI, I'm loading the ComboBox from a 2D array using a statement like
ComboBoxAddress.Column() = AddressList.

Help says ComboBox data is stored in an array, with indexes starting at
(0,0). The first row in the array doesn't become the headers; if it
did, my
header area would be populated with the first row of my data. I've
tried
this statement: ComboBoxAddress.List(-1, 0) = "Used" (to populate the
column
1 header with the text "Used") since "-1" is often used to signify a
special
case and it would be logical since the header is one row before the
first row
of data, which is row zero. That statement had no apparent effect.





All times are GMT +1. The time now is 01:12 AM.

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