excel vba populating

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 » Excel VBA : Populating a list box with a field | Excel forum

Excel VBA : Populating a list box with a field | Excel forum

resolvedResolved · Low Priority · Version 2003

Herman has attended:
Excel VBA Intro Intermediate course

Excel VBA : Populating a list box with a field

Hello,

How would I create a list box that would populate the list of HR people in a user forum list box?

Thanks

Herman

RE: Excel VBA : Populating a list box with a field

Hello Herman

Thank you for your question.

The first thing to do would be to type the names of the HR people into a list somewhere within your workbook.

You would then need to write some code that loops through the list, one row at a time; and at each point adds the name in that row to the list box.

The key piece of code that adds the item to the list box would take the form.

Count = ActiveCell.CurrentRegion.Rows.Count

With Me.listbox

For Counter = 2 To Count

.AddItem Worksheets("worksheet name").Cells(Counter, 1)

Next Counter

End With



Hope this is useful

Regards

Stephen

 

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:

Change the Default Width of All Columns in Excel 2010

If you want to change the width of the columns in your Excel 2010 spreadsheet, making them either larger or smaller, here's how:

In the Cells group on the Home tab, click Format.

Hover over the section called Cell Size and a drop down list will appear, select Default Width from this list.

In the Standard Width dialog box, enter the size you want to set as the default width and click OK.

View all Excel hints and tips


Server loaded in 0.08 secs.