问题
I'm working on my first ever VBA project, and need a bit of absolute newbie guidance.
- I have a submission form that staff will be using to submit their daily KPIs.
- I have a list box control in a user form called "lstName" that employees will use to select their name before submitting the form
- 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!
回答1:
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

来源:https://stackoverflow.com/questions/23534710/populate-list-box-with-a-named-range