Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display listbox heading (VBA for Excel2003)

    This is so basic I'm almost ashamed to ask it. (Almost). I cannot get the heading portion of a list box to show a heading. The relevant properties are:
    ColumnHeads: True
    ControlSource: (is left blank)
    RowSource: (is left blank)

    The listbox is loaded using VBA code in the UserForm_Initialize event section with the listbox.AddItem method as follows:
    lstListBox.AddItem "Text String"

    Looking in the Immediate window (and in the listbox itself), I see that the heading text is, in fact, in the list position 0. However it is simply the first item shown and is selectable along with all the rest. The heading line in the listbox above it remains blank. What else do I have to do to have the list item 0 to show as the heading?

    Thank you for your time and effort,

    John Littell

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display listbox heading (VBA for Excel2003)

    Sorry, it won't work that way. The ColumnHeads property is only effective if the row source is a worksheet range; in that case, the first row of the range will act as column headings. If the list box is populated any other way, the ColumnHeads property is ignored.

  3. #3
    3 Star Lounger
    Join Date
    May 2002
    Location
    Florence, Oregon, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display listbox heading (VBA for Excel2003)

    Thanks Hans. Bummer.

    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •