Populate list box with a named range

我们两清 提交于 2019-12-22 11:25:30

问题


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!


回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!