Setting headers in a listbox programmatically

conorohio

New Member
Joined
Jul 25, 2007
Messages
5
Hi,
I am programming a user interface in excel 2003, windows XP.

My code uses buttons to switch between two sets of information displayed in a listbox. However, since the the two sets of information do not have the same column headers, I need to redefine column widths and header names everytime I switch between them.

I can redefine column widths (historyBox1.ColumnWidths = "53 pt;110 pt;47.95 pt etc...) however I can't figure out a way to set the column headers. I would have guessed it would look something like-

historyBox1.Column(0).header = "Date"
historyBox1.Column(1).header = "City"

but I can't find anything that works like this. Does anyone know how to do it?

Thanks
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)

Watch MrExcel Video

Forum statistics

Threads
1,129,804
Messages
5,638,450
Members
417,025
Latest member
MusterDuster

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top