vba 如何通过单击按钮将值添加到 Excel 表格中?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14955192/
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
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 19:41:18 来源:igfitidea点击:
How to add values into Excel table by clicking a button?
提问by SergeyT
I need to fill catalog.
我需要填写目录。
I want to make a input Userform
for this, where by clicking a button add new product
values in Textboxes
will be inserted to specific column
我想为此输入Userform
,通过单击按钮,add new product
值Textboxes
将被插入到特定列
Private Sub CommandButton1_Click()
Sheet3.Cells.Rows.Insert
Sheet3.Cells(25, 27).Value = TextBox1.Value
End Sub
回答by Siddharth Rout
Is this what you are trying?
这是你正在尝试的吗?
Private Sub CommandButton1_Click()
With Sheet3
'~~> Insert row at the 25th row.
.Rows(25).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
'~~> Add textbox value
.Cells(25, 27).Value = TextBox1.Value
End With
End Sub