Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

adding variable names list

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Adding variable names to List Box

Adding variable names to List Box

ResolvedVersion 2003

Brian has attended:
Excel VBA Intro Intermediate course

Adding variable names to List Box

Hi Mark,

I was wondering if you were able to provide code on how to add variable names into a combobox.

Example - List of data with peoples names.

I want to loop through the code and add only unique names to the combobox.

Thanks

Brian

RE: Adding variable names to List Box

Hi Brian

Thanks for your question

I have written some code to solve your problem. I have uploaded an example workbook with the code. I have annotated that code so hopefully it will be reasonably clear. I suggest running through it line by line in break mode.

Simply the procedure cycles through the list. At the first row it writes that value into an array. It then checks to see if the contents of each subsequent row is already in the array. If it isn't then that value is written to the array.

The contents of the array are then written into the combo box

If you have any queries please feel free to repost your question

Regards

Stephen

Attached files...

Forum Answer.xls

Tue 22 Mar 2011: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Repeating headings on spreadsheets that print on more than one page

By default when you print a spreadsheet out and it prints on more than one page, the headings at the top and the side of the spreadsheet don't appear on all the pages following page 1.

To get Excel to repeat headings on all pages when printing, go to File - Page Setup - Sheet, then select the rows to repeat at the top of pages, and the columns to repeat at the side of pages by clicking on the red arrows at the right side of the two boxes under the 'Print titles' area. Then click OK.

If you view your spreadsheet in Print Preview, you should see the headings being repeated on each page.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.12 secs.