View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default listbox problem #2

I don't recall the "listbox problem 1" question (maybe the OP was looping
through the range to selectively add stuff to the listbox????).

But I can use code and have headers:

Option Explicit
Private Sub UserForm_Activate()
With Me.ListBox1
.ColumnCount = 3
.RowSource _
= Worksheets("Sheet1").Range("a2:c10").Address(exter nal:=True)
.ColumnHeads = True
End With
End Sub

(I figure there was a lot of stuff from the original thread that I missed).

=====
To the OP:

Maybe you could add some labels right above the listbox and use them for
headers.

Harald Staff wrote:

Hi Keith

You can't do that by code. Listbox column headers appear only when you
populate the box with a spreadsheet range that has columnheaders.

HTH. Best wishes Harald

"Keith" skrev i melding
...
Thank you to those who replied to my question about
changing list box text. The comments were very helpful.
Today I need to put text into the listbox column
headings. The listbox property has been set to show
three columns. Using help, I have been unable to find a
code statement that will do this. Any suggestions?

Keith


--

Dave Peterson