表名中的列表框行源空间 [英] Listbox RowSource space in sheetname

查看:26
本文介绍了表名中的列表框行源空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对用户窗体上的列表框的 RowSource 有问题.我的源是名为源数据"的工作表上的命名范围项目".我在属性窗口中尝试过源数据!项目",但由于工作表名称中的空格(我假设)而不起作用.

I have a problem with RowSource to a ListBox on a UserForm. My Source is a named Range "Project" on a sheet called "Source data". I have tried "Source data!Project" in the property window, but is does not work because of the space in the sheet name (i assume).

然后我尝试了这段代码,但它返回错误....

Then i tried this code, but it is returning error....

请帮忙

Private Sub UserForm_Initialize()

Me.LB_Project.RowSource = ThisWorkbook.Sheets("Source data").Range(Project)

end sub

推荐答案

您好,我自己找到了解决方案.

Hello i found a solution myself.

在属性窗口的 RowSource 字段中的工作表名称周围添加 '.

to add ' around the sheetname in the RowSourcefield in property window.

'源数据'!项目

Me.LB_Project.RowSource = "'Source data'!" & ThisWorkbook.Sheets("Source data").Range("Project").Address

这解决了我的工作表名称中的空格问题

This solwed my problem with the space in the sheetname

这篇关于表名中的列表框行源空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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