使用命名范围填充列表框 [英] Populate list box with a named range

查看:140
本文介绍了使用命名范围填充列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从事我第一次的VBA项目,需要一些绝对的新手指导。

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


  1. 我有一个提交表单该员工将会使用它们提交他们的日常KPI。

  2. 我有一个名为lstName的用户表单中的列表框控件,员工将在提交表单

  3. 之前使用它们的名称来选择员工名称存储在名为EmpName的Sheet11上的命名范围中。

我想引导列表框从Sheet11上的EmpName范围中绘制名称列表;但不知道我将如何在VBA中做到这一点。我将使用RowSource将列表框指向数据,但是我失去了如何做到这一点。

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.

我知道的真的很简单的问题,它可能已经在某个方面在网站上得到回答,但是由于我完全是VBA新手,所以答案超出了我。如果有人可以提供一个解释代码正在做什么的分步答案,那将是惊人的!

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!

推荐答案

选择您的Userform和您的列表框,打开属性窗口(视图 - >属性或F4)

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

在属性窗口中导航到 RowSource 属性和类型 Sheet11!EmpName

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

一个简单的 boo 例如

这篇关于使用命名范围填充列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆