excel判断每行的字符包含自身列的每行字符

阅读 85

2023-03-07


比如    B          C

           1          1

            21        21

先把原先B列的字符复制一串到C列,然后1行对比多行,逐行对比

例子:假设有300列

Sub ss()

Dim i As Integer, b As Integer



For i = 1 To 300

For b = 1 To 300

If (InStr(Cells(b, "B"), Cells(i, "C")) Or InStr(Cells(i, "B"), Cells(b, "C"))) And (Cells(b, "B") <> Cells(i, "C")) Then

Cells(b, "J") = 1

End If

Next

Next

End Sub



精彩评论(0)

0 0 举报