|
如果两行一样,将自动删除!
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Rown As Long, i As Long, arr1, arr2
Rown = Sheet2.Range("B" & Rows.Count).End(xlUp).Row + 1
Sheet1.Range("B9").Copy Sheet2.Range("B" & Rown)
Sheet1.Range("C5").Copy Sheet2.Range("C" & Rown)
Sheet1.Range("F5").Copy Sheet2.Range("D" & Rown)
Sheet1.Range("E3").Copy Sheet2.Range("E" & Rown)
Sheet1.Range("B10").Copy Sheet2.Range("F" & Rown)
Sheet1.Range("J6").Copy Sheet2.Range("G" & Rown)
For i = 1 To Rown - 1
Sheet2.Range("A" & i + 1) = i
Next i
arr1 = Sheet2.Range("B" & Rown & ":G" & Rown).Value
arr2 = Sheet2.Range("B" & Rown - 1 & ":G" & Rown - 1).Value
If arr1(1, 1) = arr2(1, 1) And arr1(1, 2) = arr2(1, 2) And arr1(1, 3) = arr2(1, 3) And arr1(1, 4) = arr2(1, 4) And arr1(1, 5) = arr2(1, 5) And arr1(1, 6) = arr2(1, 6) Then
Sheet2.Range("B" & Rown).EntireRow.Delete
End If
End Sub
|
|