Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Headings for Excel Combobox

Status
Not open for further replies.

LW

Programmer
Oct 23, 2000
20
US
I am using Excel97.
I have a 2 column combobox set to dropdown List style. How do I setup the column Headings from code?
 
Just use

Me.ComboBox1.ColumnHeads = True

and it will automatically pick the headers from the cells above the RowSource range, or the Column titles (A,B etc) if the rows start at 1.

A.C.
 
Hi

just set the ColumnHeads to True, here is how

With Me.ComboBox1
.ColumnCount = 2
.ColumnHeads = True
End With

Hope this helps.

LSTAN :)
 
acron Thanks for the quick response.
I am using the following to populate the combobox and not a range:

combo1.additem ""
combo1.List(0,0)="Col1 Item"
combo1.additem ""
combo1.List(0,1)="Col2 Item"

Actually I'm pulling the items from variables but I'm sure you get my point.
 
acron & LSTAN
I just tried your code. It works great. Thanks Guys!
 
Ok, but what if I'm using a 2-dimensional array, and not a sheet range? How could I programatically SET the column heading's text?
 
ALSO, is there a way to activate a HORIZONTAL scroll bar in a list box?

Thx
AT
 
Ok, figured out the horizontal scrollbar (just increase the column widths), but STILL can't find a way to programatically set the column headings......

Anyone???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top