Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Userform List box question

Status
Not open for further replies.

ribhead

Technical User
Jun 2, 2003
384
US
Is there a way to tell the list box what the header is? I'm picking data from a list and putting the data in a list box and I want to name the header manually. Any thoughts?

For just $19.95 you too can have a beautiful smile.
 
Simplest way is to have your data on a worksheet and reference it with the RowSource property. Then put your header row in the row above.

For example, if you have the following on a worksheet:
Code:
      B        C
145
[blue]
Code:
  Number   Name
[/color]
Code:
146
[blue]
Code:
  12345    Jones
[/color]
Code:
147
[blue]
Code:
  12346    Smith
[/color]
Code:
148
[blue]
Code:
  12347    Green
[/color]
Code:
149
[blue]
Code:
  12348    Brown
[/color]
Then set the listbox properties like this (note that the RowSource does NOT include the column heads):
Code:
  ColumnCount:
[blue]
Code:
2
[/color][/code]
ColumnHeads: [/code][blue]
Code:
True
[/color][/code]
RowSource: [/code][blue]
Code:
Sheet1!B146:C149
[/color]
Then you should get the result you want.

 
This won't work for what I'm doing Zathras. I understand what you have but I'm picking certain items from a row so the item directly above the row source may not be the header. Any other ideas??

For just $19.95 you too can have a beautiful smile.
 
Use a hidden sheet or some area on your sheet which is out of the way and not in use. You can then remove the sheet or clear the range when you close the form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top