Populate list box with a named range

cazzzac picture cazzzac · May 8, 2014 · Viewed 25.5k times · Source

I'm working on my first ever VBA project, and need a bit of absolute newbie guidance.

  1. I have a submission form that staff will be using to submit their daily KPIs.
  2. I have a list box control in a user form called "lstName" that employees will use to select their name before submitting the form
  3. Employee names are stored in a named range on "Sheet11" called "EmpName".

I want to direct the list box to draw the list of names from the "EmpName" range on Sheet11; but don't know how I would do this in VBA. I was going to use RowSource to point the list box to the data, but I am lost as to how to do this.

Really simple question I know, and it has probably been answered in some way on the site, but since I'm completely new to VBA, the answers were beyond me. If someone could provide a stepped out answer that explains what the code is doing that would be amazing!

Answer

user2140173 picture user2140173 · May 8, 2014

Select your Userform and your ListBox, turn on Properties Window (View -> Properties or F4)

In the Properties Window navigate to the RowSource property and type Sheet11!EmpName

A simple boo example

enter image description here