我在Excel中創建了一個簡單的表格,用於將數據插入電子表格。我的表中有第2行的標題和第3行的空白表格。當我將數據表格輸入第一個空行時,它從第4行開始(表格下方的第一行)。我想要將數據插入現有的表中。我怎樣才能做到這一點?從表格中插入數據
這是我的窗體添加按鈕的代碼:
Private Sub Add_Click()
TrackingDate = UserForm1.TrackingDate.Value
INS = UserForm1.INS.Value
COY = UserForm1.COY.Value
Amount = UserForm1.Amount.Value
InvoiceDate = UserForm1.InvoiceDate.Value
InvoiceNumber = UserForm1.InvoiceNumber.Value
PolicyNumber = UserForm1.PolicyNumber.Value
Reminder = UserForm1.Reminder.Value
Cheque = UserForm1.Cheque.Value
Status = UserForm1.Status.Value
Range("A" & Rows.Count).End(xlUp).Offset(1).Value = TrackingDate
Range("B" & Rows.Count).End(xlUp).Offset(1).Value = INS
Range("C" & Rows.Count).End(xlUp).Offset(1).Value = COY
Range("D" & Rows.Count).End(xlUp).Offset(1).Value = Amount
Range("E" & Rows.Count).End(xlUp).Offset(1).Value = InvoiceDate
Range("F" & Rows.Count).End(xlUp).Offset(1).Value = InvoiceNumber
Range("G" & Rows.Count).End(xlUp).Offset(1).Value = PolicyNumber
Range("H" & Rows.Count).End(xlUp).Offset(1).Value = Reminder
Range("I" & Rows.Count).End(xlUp).Offset(1).Value = Cheque
Range("J" & Rows.Count).End(xlUp).Offset(1).Value = Status
End Sub
每分鐘:http://www.meadinkent.co.uk/xl-update-list.htm – Luuklag