vba 将用户窗体文本框值传递给单元格
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19519716/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Pass UserForm textbox value to cell
提问by CBC_NS
Community, I'm moderately new to excel. I have a textbox called Box_One. This has been set up on my userform. All I want to do is have a cell value constantly equal whatever value is in the textbox.
社区,我对精益求精不太熟悉。我有一个名为 Box_One 的文本框。这已在我的用户表单上设置。我想要做的就是让单元格值始终等于文本框中的任何值。
I tried the following, but not quite sure how to implement properly
我尝试了以下,但不太确定如何正确实施
Home.Range("A2").Value = Box_One.Value
回答by Octavio
how about using the Change event of your text box to run the code you want? Something like
如何使用文本框的 Change 事件来运行您想要的代码?就像是
Private Sub TextBox1_Change()
Range("BU1").value = TextBox1.value ' specify the destination sheet and cell here
End Sub
I tested this real quick and it worked.
我很快就测试了这个,它奏效了。