|
因为文档管理需要烦请各位高手帮忙更改原有代码让每一次录入数据都保存到文件夹内的另外工作簿(恪瑞灵申请单网签)相对应单元格里,表格行数不固定。密码110 拜谢!!!
原来代码如下:
Sub 提交()
With Sheets("申请明细")
If [b2] = "" Or [b3] = "" Or [g3] = "" Or [g2] = "" Then MsgBox "填写不完整,不能保存!": End
RS = .[a65536].End(3).Row + 1
For Each sht In ActiveWorkbook.Worksheets
If sht.AutoFilterMode = True Then sht.AutoFilterMode = False
Next
ar = Range("a6:p" & [a65536].End(3).Row)
.Range("h" & RS).Resize(UBound(ar, 1), UBound(ar, 2)) = ar
.Range("a" & RS).Resize(UBound(ar, 1), 1) = Range("p3")
.Range("b" & RS).Resize(UBound(ar, 1), 1) = Range("p2")
.Range("c" & RS).Resize(UBound(ar, 1), 1) = Range("b2")
.Range("d" & RS).Resize(UBound(ar, 1), 1) = Range("g2")
.Range("e" & RS).Resize(UBound(ar, 1), 1) = Range("b3")
.Range("f" & RS).Resize(UBound(ar, 1), 1) = Range("g3")
End With
bh = "KRs" & Format(Val(Right([p2], 3)) + 1, "0000")
[p2] = "" & bh
MsgBox "录入成功!", vbOKOnly + vbInformation, "提示:"
End Sub
|
|