2013-02-19 143 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 
相關問題