TextColumn Property

I never noticed this Listbox property before, but it seems like it could be useful. According to help, the TextColumn property sets the column whose value the Text property will return. The BoundColumn property determines what the Value property returns, so this seems to bet the step sister of that.

You can now have easy access to two columns in a multicolumn Listbox. I don’t really see a downside since everything in a Listbox is text anyway, so the difference between Value and Text should be nothing. If you don’t set the TextColumn property, the Text property returns the same as Value.

This example shows two ways to access a different column than the BoundColumn: One using the List property and one using the Text/TextColumn properties.

userform and message box showing results

4 thoughts on “TextColumn Property

  1. Hi Dick

    A great use for this is having a two-column list box with and ID in the first column set to zero width. Hence the BoundColumn is 1 and the TextColumn is 2.

    ListBox.Text is what the user sees (e.g. a name)
    ListBox.Value is the corresponding ID.

    Regards

    Stephen Bullen

  2. Great post! I wonder… when typing into the combobox, how can I make it to do the matching with a specific column?

  3. It will match on the column you specify as .TextColumn. If you don’t specify a .TextColumn, it matches on the first column.


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.