excel VBA 把資料輸入至最後一行?

2015-10-18 3:39 pm
Private Sub CommandButton1_Click()
num = Range("A1").End(xlDown).Row + 1
Cells(num, 1) = TextBox1.Text
Cells(num, 2) = TextBox2.Text
Cells(num, 3) = TextBox3.Text
Cells(num, 4) = TextBox4.Text
Cells(num, 5) = TextBox5.Text
Cells(num, 6) = TextBox6.Text
Cells(num, 7) = TextBox7.Text
Cells(num, 8) = TextBox8.Text
Cells(num, 9) = TextBox9.Text

End Sub
不知道該怎麼修改

回答 (1)

2015-10-19 11:54 am
要不要試試

Private Sub CommandButton1_Click()
Dim i As Integer
Dim num As Integer
num = [A65536].End(xlUp).Row + 1
For i = 1 To 9
Cells(num, i) = Controls("textbox" & i).Text
Next
End Sub


收錄日期: 2021-05-04 02:04:01
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20151018073948AAofraU

檢視 Wayback Machine 備份