|
楼主 |
发表于 2018-2-28 22:51
|
显示全部楼层
Sub d()
Dim Reg As New RegExp, Mac As MatchCollection, M As Match, arr(), brr()
Dim Dic As New Dictionary
brr = Range("b4").CurrentRegion.Resize(, 2)
Reg.Global = 1: Reg.Pattern = "^([一-龥]+).+: ([一-龥]+)": Reg.MultiLine = 1
Set Mac = Reg.Execute([A2]): ReDim arr(1 To Mac.Count, 1 To 2)
For Each M In Mac
r = r + 1: c = 0
For Each ii In M.SubMatches
c = c + 1: arr(r, c) = ii
Next
Dic(arr(r, 1)) = arr(r, 2)
Next
For i = 2 To UBound(brr)
If Dic.Exists(brr(i, 1)) Then
If Dic(brr(i, 1)) = "已阅读" Then
brr(i, 2) = "是"
Else
brr(i, 2) = "否"
End If
Else
brr(i, 2) = "否"
End If
Next
Range("c4").Resize(65500, 1).ClearContents: Range("b4").CurrentRegion.Resize(, 2) = brr
End Sub |
|