谢谢qh8600论坛老师,运行速度很快,不过我只想判断图1。图2、图3只是列举,不用判断。我把你的代码改动一下,可只运行图1,看看对不对。
Sub demo()
Dim ar
a = Cells(Rows.Count, 12).End(xlUp).Row
x = 0
b = Cells(1, Columns.Count).End(1).Column
For j = 12 To b
If Cells(1, j) = Cells(2, j) Then x = x + 1
Next
If x = b - 11 Then
Cells(1, 11) = "相同"
Else
Cells(1, 11) = "不相同"
End If
End Sub