我正在开发一个脚本,该脚本将遍历第2行中的每个单元,并在第1行中找到相同的脚本,并计算有多少相同。 现在我被困住了。
Sub compare()
final_col = Cells(7, 250).End(xlToLeft).Column
Dim i As Integer, j As Integer
Dim Line1 As Range
Dim Line2 As Range
Match = 0
Line1 = Range(Cells(4, 7), Cells(7, final_col))
Line2 = Range(Cells(12, 7), Cells(7, final_col))
For Each i In Line2
For Each j In Line1
If i = j Then
Match = +1
End If
Next j
Next i
End Sub
对于每个循环,最好的方法是将数据填充到其中。