|
Sub 矩形1_Click()
On Error Resume Next
Dim ar1(1 To 5, 0 To 6)
dh = Sheet1.[f2]
Set a = Sheet2.[a:a].Find(dh)
If Not a Is Nothing Then: MsgBox "该单号已存在,不得重复录入。": Exit Sub '重复单号判断
With Sheet1
For i1 = 8 To 12 '表体数据
M1 = M1 + 1
If Sheet1.Cells(i1, 1) <> "" Then
ar1(M1, 0) = Sheet1.[f2]
Else
ar1(M1, 0) = ""
End If
ar1(M1, 1) = Sheet1.Cells(i1, 1)
ar1(M1, 2) = Sheet1.Cells(i1, 2)
ar1(M1, 3) = Sheet1.Cells(i1, 3)
ar1(M1, 4) = Sheet1.Cells(i1, 4)
ar1(M1, 5) = Sheet1.Cells(i1, 5)
ar1(M1, 6) = Sheet1.Cells(i1, 6)
Next
End With
Sheet2.[A65536].End(3).Offset(1).Resize(M1, 7) = ar1
End Sub |
|