adding variable names list

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

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

resolvedResolved · Low Priority · Version 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:

No Zeros

Want all the zeros in your worksheet to appear blank? Choose Tools/Options, Click on the View Tab, Deselect the Zero Values Option, Click OK.
Easy wasn't it? But be aware that these cells are not actually blank, they still contain the value zero. This is important because certain functions (ie AVERAGE) make a distinction between blank cells and those with a zero value.

View all Excel hints and tips


Server loaded in 0.08 secs.