2013-02-19 138 views
0

我需要填写目录。如何通过单击按钮将值添加到Excel表中?

我想打一个输入Userform这一点,在那里通过点击按钮在Textboxesadd new product值将被插入到特定的列

Private Sub CommandButton1_Click() 

Sheet3.Cells.Rows.Insert 
Sheet3.Cells(25, 27).Value = TextBox1.Value 



End Sub 
+0

插入眨眼行,更改单元格的值textbox.text – SergeyT 2013-02-19 10:39:56

+0

你能分享你的努力和哪儿是你坚持的代码? – 2013-02-19 10:40:50

+0

错误1004 我知道它不能工作... – SergeyT 2013-02-19 10:52:57

回答

1

这是你想什么呢?

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 
相关问题