|
257公共-处理.zip
(43.74 KB, 下载次数: 0)
- Sub 对比()
- Dim Dic As Object
- Set Dic = CreateObject("scripting.dictionary")
- For i = 4 To Range("A65535").End(xlUp).Row - 1
- Cells(i, "B").Interior.ColorIndex = xlNone
- If Dic.exists(Cells(i, "B").Value) Then
- Cells(i, "D") = Split(Dic(Cells(i, "B").Value), "|")(0)
- Dic(Cells(i, "B").Value) = (CInt(Split(Dic(Cells(i, "B").Value), "|")(0)) + 1) & "|" & Split(Dic(Cells(i, "B").Value), "|")(1)
- Else
- Dic(Cells(i, "B").Value) = "1|0"
- Cells(i, "D") = 1
- End If
- Next i
- For i = 4 To Range("E65535").End(xlUp).Row - 1
- Cells(i, "F").Interior.ColorIndex = xlNone
- If Dic.exists(Cells(i, "F").Value) Then
- Cells(i, "H") = Split(Dic(Cells(i, "F").Value), "|")(1)
- Dic(Cells(i, "F").Value) = Split(Dic(Cells(i, "F").Value), "|")(0) & "|" & (CInt(Split(Dic(Cells(i, "F").Value), "|")(1)) + 1)
- Else
- Dic(Cells(i, "F").Value) = "0|1"
- Cells(i, "H") = 1
- End If
- Next i
- For i = 4 To Range("A65535").End(xlUp).Row - 1
- If Dic.exists(Cells(i, "B").Value) Then
- Cells(i, "C") = Dic(Cells(i, "B").Value)
- If Split(Cells(i, "C"), "|")(0) <> Split(Cells(i, "C"), "|")(1) Then
- Cells(i, "B").Interior.ColorIndex = 7
- End If
- End If
- Next i
- For i = 4 To Range("E65535").End(xlUp).Row - 1
- If Dic.exists(Cells(i, "F").Value) Then
- Cells(i, "G") = Dic(Cells(i, "F").Value)
- If Split(Cells(i, "G"), "|")(0) <> Split(Cells(i, "G"), "|")(1) Then
- Cells(i, "F").Interior.ColorIndex = 27
- End If
- End If
- Next i
- MsgBox "分析对比完成,请查阅填色的单元格", vbOKOnly + vbInformation, "提示"
- End Sub
- Private Sub CommandButton1_Click()
- Call 对比
- End Sub
复制代码
|
|