此宏在单元格A10中添加数据。现在,每次再次运行时,数据都会被覆盖。我怎样才能在下面添加1个cel?
Sub Invoer()
Dim Debiteurnummer As Integer
Dim Aantalpallets As Integer
Dim Totaalgewicht As Integer
Debiteurnummer = InputBox("Debiteurnummer invoeren")
Aantalpallets = InputBox("Aantal Pallets?")
Totaalgewicht = InputBox("Totaal Gewicht?")
Range("A10").Value = Debiteurnummer
Range("A10").Offset(0, 2) = Aantalpallets
Range("A10").Offset(0, 3) = Totaalgewicht
End Sub
答案 0 :(得分:0)
添加 LastRow 的动态搜索:
Sub Invoer()
Dim Debiteurnummer As Integer
Dim Aantalpallets As Integer
Dim Totaalgewicht As Integer
Dim LastRow As Long
Debiteurnummer = InputBox("Debiteurnummer invoeren")
Aantalpallets = InputBox("Aantal Pallets?")
Totaalgewicht = InputBox("Totaal Gewicht?")
LastRow = Cells(Rows.count, "A").End(xlUp).row
Range("A" & LastRow + 1).Value = Debiteurnummer
Range("A" & LastRow + 1).Offset(0, 2) = Aantalpallets
Range("A" & LastRow + 1).Offset(0, 3) = Totaalgewicht
End Sub