终于把三楼会重复的问题解决了.只需要加上有色的代码就行了. Sub 相同字符() Dim a As Integer Dim b As Integer Dim d As Integer Sheets("sheet1").Range("C2:C65536").ClearContents With Sheets("sheet1") For d = 2 To .Range("A65536").End(xlUp).Row For a = 1 To Len(.Cells(d, 1)) For b = 1 To Len(.Cells(d, 2)) If Instr(.Cells(d,3),Mid(.Cells(d,1),a,1)=0 Then If Mid(.Cells(d, 1), a, 1) = Mid(.Cells(d, 2), b, 1) Then If .Cells(d, 3) = "" Then .Cells(d, 3) = Mid(.Cells(d, 1), a, 1) Else .Cells(d, 3) = .Cells(d, 3) & Mid(.Cells(d, 1), a, 1) End If End If End If Next b Next a Next d End With End Sub |