|
楼主 |
发表于 2013-2-21 21:34
|
显示全部楼层
我想用代码解决, 下面是其中的一段, 可是一运行就提示不能取得类WorksheetFunction的match属性.
For i = 1 To rm
sfzh = xs(i)
With Application.WorksheetFunction
m = .Match(sfzh, Sheet2.Range("A2:A65536"), 0)
If IsNumeric(m) = "true" Then
a = a + 1
m = .Match(sfzh, Sheet2.Range("A2:A65536"), 0) + 1 '查找当前合同号在年末结息表中的位置
Sheets("待查身份证号").Cells(i + 1, 2).Interior.ColorIndex = 6 '黄色
Sheets("中职汇总").Cells(m, 2).Interior.ColorIndex = 3 '红色
If Cells(i + 1, 2).Comment Is Nothing Then
Cells(i + 1, 2).AddComment '插入批注
Cells(i + 1, 2).Comment.Text Text:="身份证号码重复(第" & i + 1 & "行和第" & m & "行)" & Chr(10)
Else
Cells(i + 1, 2).Comment.Text Text:=Cells(i + 1, 2).Comment.Text & "身份证号码重复(第" & i & "人和第" & m & "人)"
End If
Sheets("查重结果").Cells(a + 1, 1) = xs(i)
Sheets("查重结果").Cells(a + 1, 2) = Sheets("待查身份证号").Cells(i + 1, 3)
Sheets("查重结果").Cells(a + 1, 3) = Sheets("待查身份证号").Cells(i + 1, 4)
Sheets("查重结果").Cells(a + 1, 4) = Sheets("待查身份证号").Cells(i + 1, 5)
Sheets("查重结果").Cells(a + 1, 5) = Sheets("待查身份证号").Cells(i + 1, 6)
Sheets("查重结果").Cells(a + 1, 7) = Sheets("中职汇总").Cells(m, 2)
Sheets("查重结果").Cells(a + 1, 8) = Sheets("中职汇总").Cells(m, 10)
Sheets("查重结果").Cells(a + 1, 9) = Sheets("中职汇总").Cells(m, 12)
Sheets("查重结果").Cells(a + 1, 10) = Sheets("中职汇总").Cells(m, 19)
End If
End With
Next i
|
|