|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub 数据保存()
If (Sheets("结算单").Range("c3") <> "" And Sheets("结算单").Range("i3") <> "" And Sheets("结算单").Range("e4") <> "" And Sheets("结算单").Range("k4") <> "" And Sheets("结算单").Range("q4") <> "" And Sheets("结算单").Range("r4") <> "" And Sheets("结算单").Range("b5") <> "" And Sheets("结算单").Range("g5") <> "" And Sheets("结算单").Range("l5") <> "" And Sheets("结算单").Range("o5") <> "" And Sheets("结算单").Range("b6") <> "" And Sheets("结算单").Range("g6") <> "" And Sheets("结算单").Range("b7") <> "" And Sheets("结算单").Range("g7") <> "" And Sheets("结算单").Range("l7") <> "" And Sheets("结算单").Range("g11") <> "" And Sheets("结算单").Range("p13") <> "") Then
r = Sheets("结算明细").Range("b65536").End(3).Row + 1
arr = Array("b5", "b5", "g6", "j6", "l6", "p6", "e4", "k4", "q4", "r4", "i3", "g5", "l5", "o5", "q5", "o3", "c3", "b7", "g7", "l7", "q7", "B11", "d8", "h8", "k8", "n8", "d9", "h9", "k9", "n9", "d10", "h10", "k10", "q8", "q9", "n10", "q10", "b11", "g11", "k11", "o11", "d12", "i12", "p12", "p13")
For c = 1 To 45
Sheets("结算明细").Cells(r, c) = Sheets("结算单").Range(arr(c - 0)
Next
Sheets("结算明细").Range("b" & r) = Now()
MsgBox "数据保存成功"
ActiveWorkbook.Save
Else
MsgBox "“结算单没有填写完整”"
End If
End Sub
|
|