Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Listbox Column Heading Help

I'm trying to populate a listbox with VBA.

I can't figure out a way to get column headings.

This is my code.

With UserForm1.ListBox1
.ColumnCount = 2
.RowSource = ""
.ColumnHeads = True
.Enabled = True
.ColumnWidths = "70 pt;100 pt"
End With


With UserForm1.ListBox1
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
' Etc, etc

End With


It loads the values but I can't get headings.

I want to do this in code, as the headings I want are "Date","Amount" but
they don't exist anywhere on my workbook at this point.

Thanks in advance,
Alan Sawyer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Listbox Column Heading Help

You can only use column headings if you use the rowsource property to fill
the listbox. Then you can put the column headings in the row just above the
rowsource range.

--
Regards,
Tom Ogilvy


wrote in message
...
I'm trying to populate a listbox with VBA.

I can't figure out a way to get column headings.

This is my code.

With UserForm1.ListBox1
.ColumnCount = 2
.RowSource = ""
.ColumnHeads = True
.Enabled = True
.ColumnWidths = "70 pt;100 pt"
End With


With UserForm1.ListBox1
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
.AddItem
.List(.ListCount - 1, 0) = "test1"
.List(.ListCount - 1, 1) = "test2"
' Etc, etc

End With


It loads the values but I can't get headings.

I want to do this in code, as the headings I want are "Date","Amount" but
they don't exist anywhere on my workbook at this point.

Thanks in advance,
Alan Sawyer



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Column Heading SEC Finance Excel Discussion (Misc queries) 1 January 21st 10 01:20 AM
I want column heading non-scrolling and rows of each column scrol Q Abdul New Users to Excel 1 July 22nd 08 03:44 PM
In a table produce an value by column heading and row heading naflan Excel Worksheet Functions 1 December 27th 05 05:18 PM
Need to put a name in the column heading windsorhartung Excel Discussion (Misc queries) 6 February 19th 05 06:36 AM
Need Macro to Find Column Heading -- if none, then insert new column Jeff[_43_] Excel Programming 0 December 15th 04 07:08 AM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"