• Display listbox heading (VBA for Excel2003)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Display listbox heading (VBA for Excel2003)

    Author
    Topic
    #436946

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1037399

      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.

    Viewing 0 reply threads
    Reply To: Display listbox heading (VBA for Excel2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: