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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,214,400
Messages
6,119,292
Members
448,885
Latest member
LokiSonic

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
Back
Top