|
Private Sub CommandButton1_Click()
'A与B比对
For i1 = 1 To Range("A65536").End(3).Row
If Cells(i1, 1) = Cells(i1, 2) Then
Cells(i1, 7) = "Y"
End If
If Cells(i1, 1) <> Cells(i1, 2) Then
Cells(i1, 7) = "N"
End If
If Cells(i1, 1) = "" Or Cells(i1, 2) = "" Then
Cells(i1, 7) = ""
End If
Next
'A与C比对
For i1 = 1 To Range("A65536").End(3).Row
If Cells(i1, 1) = Cells(i1, 3) Then
Cells(i1, 8) = "Y"
End If
If Cells(i1, 1) <> Cells(i1, 3) Then
Cells(i1, 8) = "N"
End If
If Cells(i1, 1) = "" Or Cells(i1, 3) = "" Then
Cells(i1, 8) = ""
End If
Next
'A与D比对
For i1 = 1 To Range("A65536").End(3).Row
If Cells(i1, 1) = Cells(i1, 4) Then
Cells(i1, 9) = "Y"
End If
If Cells(i1, 1) <> Cells(i1, 4) Then
Cells(i1, 9) = "N"
End If
If Cells(i1, 1) = "" Or Cells(i1, 4) = "" Then
Cells(i1, 9) = ""
End If
Next
'B与C比对
For i1 = 1 To Range("A65536").End(3).Row
If Cells(i1, 2) = Cells(i1, 3) Then
Cells(i1, 10) = "Y"
End If
If Cells(i1, 2) <> Cells(i1, 3) Then
Cells(i1, 10) = "N"
End If
If Cells(i1, 2) = "" Or Cells(i1, 3) = "" Then
Cells(i1, 10) = ""
End If
Next
'B与D比对
For i1 = 1 To Range("A65536").End(3).Row
If Cells(i1, 2) = Cells(i1, 4) Then
Cells(i1, 11) = "Y"
End If
If Cells(i1, 2) <> Cells(i1, 4) Then
Cells(i1, 11) = "N"
End If
If Cells(i1, 2) = "" Or Cells(i1, 4) = "" Then
Cells(i1, 11) = ""
End If
Next
'C与D比对
For i1 = 1 To Range("A65536").End(3).Row
If Cells(i1, 3) = Cells(i1, 4) Then
Cells(i1, 12) = "Y"
End If
If Cells(i1, 3) <> Cells(i1, 4) Then
Cells(i1, 12) = "N"
End If
If Cells(i1, 3) = "" Or Cells(i1, 4) = "" Then
Cells(i1, 12) = ""
End If
Next
End Sub
|
|