Excel-VBA:从表单控件获取值
问题说明
嵌入工作表 sheet1
我有一个名为 combobox_test
的表单控件组合框,它选择了值 x
Embedded in the worksheet sheet1
I have a Form Control combo box named combobox_test
and it has selected value x
除此之外,我还嵌入了一个按钮,当我按下它时,我希望它获取 combobox_test
的值并将其放在 something.Rows(y).但我无法让它工作并且有点沮丧.也许你可以指出我正确的方向
in addition to that, i also have embbeded a button that when i press it i want it to take the value of combobox_test
and place it in something.Rows(y)
. But i cant get it working and am getting a bit frustrated. Maybe you can point me in the right direction
Sub ButtonPressed_sample()
Dim value As String
Set putItRng = Range("theCells")
putItRng.Rows(1) = ActiveSheet.Shapes("combobox_test").Value
End Sub
有什么建议吗?我是 VBA 的绝对初学者,所以请尽可能详细.谢谢
Any advise? Am an absolute beginner in VBA, so please be as detailed as you can. Thanks
正确答案
我不确定这是你想要的,但这是一个开始.Shape 对象没有 Value 属性,这是错误的来源.有一个 DropDown 对象已被弃用,但仍然可用.
I'm not sure this is what you want, but it's a start. The Shape object doesn't have a Value property, which is the source of the error. There is a DropDown object that is deprecated, but still available.
Sub ButtonPressed_sample()
Set putitrng = Range("theCells")
putitrng.Rows(1) = ActiveSheet.DropDowns("combobox_test").value
End Sub
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /reply/detail/tanhcgakak
-
YouTube API 不能在 iOS (iPhone/iPad) 工作,但在桌面浏览器工作正常?
it1352 07-30 -
iPhone,一张图像叠加到另一张图像上以创建要保存的新图像?(水印)
it1352 07-17 -
保持在后台运行的 iPhone 应用程序完全可操作
it1352 07-25 -
使用 iPhone 进行移动设备管理
it1352 07-23 -
在android同时打开手电筒和前置摄像头
it1352 09-28 -
扫描 NFC 标签时是否可以启动应用程序?
it1352 08-02 -
检查邮件是否发送成功
it1352 07-25 -
Android微调工具-删除当前选择
it1352 06-20 -
希伯来语的空格句子标记化错误
it1352 06-22 -
Android App 和三星 Galaxy S4 不兼容
it1352 07-20