本帖最后由 cotytome 于 2013-1-12 16:20 编辑
qqaa266 发表于 2013-1-12 13:05
已经按要求做好了
相当完美,谢谢您的帮助。。。。现在的问题是我要继续增加统计的内容,如在下面继续统计出“电能表校验”出现的次数(注:电能表现场校验、电能表校验、电能表检验,三个工作性质一样,都应统计为电能表校验出现的,统计原则与搭头、搭火一样)
自己试着修改了一下,但是还是出错。。。。。还恳请您帮忙看看,要怎么修改呢,再次感谢您的无私帮助,谢谢!!!
Sub dkj()
rw = Sheet1.Cells(65536, 1).End(xlUp).Row
arr = Sheet1.Range(Sheet1.Cells(2, 1), Sheet1.Cells(rw, 2))
rrw = Sheet1.Cells(65536, 6).End(xlUp).Row
brr = Sheet1.Range(Sheet1.Cells(2, 6), Sheet1.Cells(rrw, 7))
For j = 1 To rrw - 1
brr(j, 2) = 0
Next
For i = 1 To rw - 1
For j = 1 To rrw - 1
If InStr(1, Replace(arr(i, 1), "搭头", "搭火"), brr(j, 1)) > 0 Then
brr(j, 2) = brr(j, 2) + 1
ElseIf InStr(1, Replace(arr(i, 2), "搭头", "搭火"), brr(j, 1)) > 0 Then
brr(j, 2) = brr(j, 2) + 1
End If
If InStr(1, Replace(arr(i, 1), "电能表现场校验", "电能表校验","电能表检验"), brr(j, 1)) > 0 Then
brr(j, 2) = brr(j, 2) + 1
ElseIf InStr(1, Replace(arr(i, 2),"电能表现场校验", "电能表校验","电能表检验"), brr(j, 1)) > 0 Then
brr(j, 2) = brr(j, 2) + 1
End If
Next
Next
Sheet1.Range(Sheet1.Cells(2, 6), Sheet1.Cells(rrw, 7)) = brr
End Sub
|