Private Sub CommandButton1_Click()
NextRow = 2
Sheets("data").Cells(NextRow, 2) = Now
Sheets("data").Cells(NextRow, 3) = Sheets("sheet1").Cells(NextRow, 2)
Sheets("data").Cells(NextRow, 4) = ThisWorkbook.Sheets("Sheet1").Range("b3")
Sheets("data").Cells(NextRow, 5) = ThisWorkbook.Sheets("Sheet1").Range("b4")
Sheets("data").Cells(NextRow, 6) = ThisWorkbook.Sheets("Sheet1").Range("b5")
Sheets("data").Cells(NextRow, 7) = ThisWorkbook.Sheets("Sheet1").Range("b6")
Sheets("data").Cells(NextRow, 8) = ThisWorkbook.Sheets("Sheet1").Range("b7")
Sheets("data").Cells(NextRow, 9) = ThisWorkbook.Sheets("Sheet1").Range("b8")
Sheets("data").Cells(NextRow, 10) = ThisWorkbook.Sheets("Sheet1").Range("b10")
Sheets("data").Cells(NextRow, 11) = ThisWorkbook.Sheets("Sheet1").Range("b11")
Sheets("data").Cells(NextRow, 12) = ThisWorkbook.Sheets("Sheet1").Range("b12")
End Sub
这是我的代码。每当我继续给予价值时,它就会覆盖。怎么改呢?如何进入单独的行?
答案 0 :(得分:1)
你可以弹出一个小循环来发现下一个空行,例如(未经测试!):
NextRow=2
do until Sheets("data").Cells(NextRow,2) = ""
NextRow = NextRow + 1
Loop