0
我的問題是與列「A」。在這一列中,今天的日期應該粘貼在第一個空白行中。但是我粘貼了兩次。第一次顯示UserForm1時,第二次單擊CommandButton1時。一切工作正常(從UserForm1數據粘貼到最後一行+ 1的問題是隻能用「A」欄 請找到下面的代碼:。值被粘貼兩列
Private Sub CommandButton1_Click()
Call UserForm_Initialize
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim LastRow As Long, ws As Worksheet
'UserForm1.Label9.Caption = ws.Range("A1").Value
Set ws = Sheets("Log")
With ComboBox1
.AddItem "Quality"
.AddItem "Time"
.AddItem "Money"
End With
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1 'ostatni wiersz
'entry date
ws.Range("A1").Copy
Sheets("Log").Range("A" & LastRow).PasteSpecial xlPasteValues
'pasting data from form
'ws.Range("A" & LastRow).Value = Label9.Caption
ws.Range("B" & LastRow).Value = TextBox8.Text
ws.Range("C" & LastRow).Value = TextBox1.Text
ws.Range("D" & LastRow).Value = TextBox2.Text
ws.Range("E" & LastRow).Value = TextBox3.Text
ws.Range("F" & LastRow).Value = TextBox4.Text
ws.Range("G" & LastRow).Value = TextBox5.Text
ws.Range("H" & LastRow).Value = ComboBox1.Text
ws.Range("I" & LastRow).Value = TextBox6.Text
ws.Range("J" & LastRow).Value = TextBox7.Text
End Sub
請幫
非常感謝你的詳細信息。現在我明白它是如何與對方進行溝通的,以及爲什麼會這樣做。你很棒! – Igor
沒問題,pozdrowienia z Poznania;) – Limak