这是保存的原代码,试了一下每次保存时都会在41305行产生一条数据,不知道为什么?拜求大师指导
Sub 保存()
i = Worksheets("数据2").Cells(Rows.Count, 1).End(3).Row + 1
With Worksheets("数据2")
'.Cells(i, 1) = Cells(1, "o") '编号
.Cells(i, 2) = Cells(3, "d")
.Cells(i, 3) = Cells(3, "k")
.Cells(i, 4) = Cells(5, "p")
.Cells(i, 5) = Cells(2, 2)
.Cells(i, 6) = Cells(5, "f")
.Cells(i, 7) = Cells(5, "g")
.Cells(i, 8) = Cells(5, "h")
.Cells(i, 9) = Cells(5, "j")
' .Cells(i, 8) = Cells(5, "h")
.Cells(i, 11) = Cells(5, "i")
.Cells(i, 12) = Cells(5, "k")
.Cells(i, 13) = Cells(5, "n")
.Cells(i, 14) = Cells(6, "p")
.Cells(i, 15) = Cells(6, "d")
.Cells(i, 16) = Cells(7, "o")
'.Cells(i, 15) = Cells(6, "d")
.Cells(i, 18) = Cells(8, "c")
.Cells(i, 19) = Cells(8, "m")
.Cells(i, 20) = Cells(2, "o")
'.Cells(i, 19) = Cells(8, "g")
'.Cells(i, 20) = Cells(8, "m")
'.Cells(i, 21) = Cells(2, 2)
'.Cells(i, 22) = Cells(2, "g")
'.Cells(i, 23) = Cells(2, "j")
'.Cells(i, 24) = Cells(2, "o")
' .Cells(i, 25) = Cells(10, "c")
' .Cells(i, 26) = Cells(10, "i")
' .Cells(i, 27) = Cells(10, "m")
' .Cells(i, 28) = Cells(10, "o")
' .Cells(i, 29) = Cells(9, "c")
Sheet2.Protect Password:="ffkqwangyuezhou"
End With
MsgBox "运费单已保存,请查看确认", 289, "提醒 !!!"
Sheets("数据").Activate
End sub |