Sub 提交纸张类来料检验报告并清空数据()
Dim i, x, m, j, n
m = Sheets("纸张类-来料检报告数据库").Cells(Rows.Count, 2).End(3).Row
If m = 2 Then m = 3
If m < 4 Then ''''''''''''''''@@@@@@@@@@@@
arr2 = Sheets("纸张类-来料检报告数据库").Range("c4:h4") ''''''''''''''''@@@@@@@@@@@@
Else ''''''''''''''''@@@@@@@@@@@@
arr2 = Sheets("纸张类-来料检报告数据库").Range("c4:h" & m) ''''''''''''''''@@@@@@@@@@@@
End If ''''''''''''''''@@@@@@@@@@@@
ReDim arr(1 To 1, 1 To 112)
crr = Range("g12").Resize(22, 7)
brr = [{"m3","B4","D4","B5","B6","B7","D6","D6","G4","D8","G8","B8","g5","g6","g7"}]
brr2 = [{"c34","c35","g35","n35","B36","D36","g36","m36"}]
dh = Sheets("纸张类-来料检验").Cells(4, 2)
wllx = Sheets("纸张类-来料检验").Cells(7, "d") ''''''''''''''''@@@@@@@@@@@@
If dh = "" Then
MsgBox " (⊙o⊙)您好-这么懒,单号都不写。请完善后再提交。"
Exit Sub
End If
If wllx = "" Then
MsgBox " (⊙o⊙)您好-这么懒,“物料类型”都不写。请完善后再提交。"
Exit Sub
End If
For i = 1 To UBound(arr2) ''''''''''''''''@@@@@@@@@@@@
If arr2(i, 1) & arr2(i, 6) = dh & wllx Then ''''''''''''''''@@@@@@@@@@@@
MsgBox " (⊙o⊙)本单号已保存。不得再次提交。" ''''''''''''''''@@@@@@@@@@@@
Exit Sub ''''''''''''''''@@@@@@@@@@@@
End If ''''''''''''''''@@@@@@@@@@@@
Next ''''''''''''''''@@@@@@@@@@@@
arr(1, 1) = m - 2
For j = 1 To UBound(brr)
arr(1, j + 1) = Range(brr(j))
Next
For j = 1 To UBound(brr2)
arr(1, j + 104) = Range(brr2(j))
Next
For j = 17 To 104 Step 4
n = n + 1
arr(1, j) = crr(n, 1)
arr(1, j + 1) = crr(n, 2)
arr(1, j + 2) = crr(n, 3)
arr(1, j + 3) = crr(n, 7)
Next
Sheets("纸张类-来料检报告数据库").Cells(m + 1, 1).Resize(1, 112) = arr
Range("B4,D4,G4,B5,B6,D6,B7,B8,D8,G8,G12:I33,M12:M33,C34,C35,G35,N35,B36,D36,G36,M36").Select
Selection.ClearContents
Range("B4").Select
MsgBox " (⊙o⊙)您好-提交成功,清空完毕"
End Sub |