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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listbox Column Headings

Status
Not open for further replies.

stikare2

Programmer
Mar 7, 2002
3
GB
Hi,

I have a data entry form for an excel spreadsheet and I am struggling with the column headers for the listbox that displays rows of data in the spreadsheet.
My problem is that when I set the columnheads property of the listbox, it shows the headings as Column A, Column B, Column C, etc. Instead I want the column headings to be the first row of data (i.e. Date, Addressee, Sender, etc)

Can anyone suggest how I can go about doing this?

Many Thanks in advance.

S.
 
Hi stikare2,

Here's what I did, and it didn't take very long.

1) On the database sheet, I assigned range names to each of the field name cells. I used "fld_1", "fld_2", etc.

2) On a separate sheet, in cell C3, I entered the formula =fld_1.

3) I copied this formula down for the number of fields in the database.

4) I then edited each of these formulas. For example, for cell C4, <F2> <Backspace> 2 <Enter>.

5) For this list in Column C, I assigned a range name of &quot;fld_list&quot;. This cell named &quot;fld_list&quot; is later used as the &quot;Input range&quot; in the ListBox.

6) In cell C1, I entered the label &quot;fld_list&quot; to denote that I had named this range &quot;fld_list&quot;.

7) In cell B2, I entered the number 1, and in cell B3, I entered the number 2.

8) I then highlighted B2 and B3, and dragged down for the number of field names - i.e. filling column B with sequential numbers opposite each field name.

9) I then assigned the range name &quot;fld_table&quot; to the range B2:Cxx - where xx represents the row number of you last field name.

10) I then enter the label &quot;fld_table&quot; in cell A2 - as a reference.

11) Still on the separate sheet, in cell F2, I assigned the range name &quot;user_choice&quot; and in cell E2, I entered the label &quot;user_choice. This cell named &quot;user_choice&quot; is later used as the &quot;Cell link&quot; in the ListBox.

12) In cell F4, I assigned the range name &quot;result&quot;, and in cell E4 I entered the label &quot;result&quot;.

13) In cell F4, I entered the following formula:
=VLOOKUP(user_choice,fld_table,2) ...which provides the result of the user's choice in the ListBox.

I've &quot;detailed&quot; the steps for the benefit of &quot;everyone&quot; - including those who are new enough to Excel to require the step-by-step approach.

On this note, one final step-by-step instruction - Re Assigning a Range Name...
1) Highlight the cell or range-of-cells.
2) Hold down the <Alt> key and hit the <F3> key.
3) Type the name.
4) Hit <Enter>.

Caution: Don't use names that will conflict eith cell coordinates or with Visual Basic commands. To be safe, use a character like the &quot;_&quot; character. e.g. instead of using a name like &quot;E10&quot;, use &quot;E_10&quot;. Instead of &quot;Sheet1&quot;, use &quot;Sheet_1&quot;.

That's it. I hope this is what you were wanting. Please advise as to how it &quot;fits&quot;.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top