|
Sub 打印保存()
Application.ScreenUpdating = False
Dim n%, m%, x%, y%, k%
On Error GoTo 100
If [C3] = "" Or [I3] = "" Or [I2] = "" Then
MsgBox "信息没有填写完整,不能保存!"
Else
100:
If Sheets("数据库").[A:A].Find([I2]) = [I2] Then MsgBox "此单已经保存过了!": End
m = Sheets("数据库").[A65536].End(xlUp).Row + 1
With Sheets("数据库")
.Cells(m, "A").Value = [I2] '编号
.Cells(m, "B").Value = [C3] '开单日期
.Cells(m, "C").Value = [I3] '客户
.Cells(m, "D").Value = [I4] '车号
.Cells(m, "E").Value = [A7] '货物1
.Cells(m, "F").Value = [E7] '数量
.Cells(m, "G").Value = [F7] '单价
.Cells(m, "H").Value = [A8] '货物2
.Cells(m, "I").Value = [E8] '数量
.Cells(m, "J").Value = [F8] '单价
.Cells(m, "K").Value = [A9] '货物3
.Cells(m, "L").Value = [E9] '数量
.Cells(m, "M").Value = [F9] '单价
.Cells(m, "N").Value = [A10] '货物4
.Cells(m, "O").Value = [E10] '数量
.Cells(m, "P").Value = [F10] '单价
.Cells(m, "Q").Value = [A11] '货物5
.Cells(m, "R").Value = [E11] '数量
.Cells(m, "S").Value = [F11] '单价
.Cells(m, "T").Value = [A12] '货物6
.Cells(m, "U").Value = [E12] '数量
.Cells(m, "V").Value = [F12] '单价
.Cells(m, "W").Value = [K13] '总价
End With
MsgBox "提交成功!"
Dim no$
no = Format(Now, "yymmdd")
[I2] = IIf(no = Left([I2], 6), [I2] + 1, no * 1000 + 1)
End If
ActiveSheet.PrintOut
ActiveWorkbook.Save
Application.ScreenUpdating = True
|
|