|
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 2 And Target.Column < 9 Then
W = Target.Row
If Len(Cells(W, 3)) * Len(Cells(W, 4)) * Len(Cells(W, 5)) * Len(Cells(W, 8)) <> 0 And Target.Count = 1 Then
Application.EnableEvents = False
ARR = Range("C1:H" & Range("C65536").End(3).Row - 1)
For I = 1 To UBound(ARR)
If ARR(I, 1) = Cells(W, 3) And ARR(I, 2) = Cells(W, 4) And ARR(I, 3) = Cells(W, 5) And ARR(I, 6) = Cells(W, 8) Then
With Range("C" & I & ":H" & I)
.Font.FontStyle = "加粗"
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Interior.ColorIndex = 6
End With
If MsgBox("输入数据与第 " & I & " 行相同!是否需要删除?", 4 + 32 + 256) = 6 Then
Rows(W).Delete
Range("C2:H" & I).Interior.ColorIndex = 0
End If
End If
Next
Application.EnableEvents = True
End If
End If
End Sub |
|