我有一个2000x20
excel文件。 B列中的每个单元格都有一个6位数字。当我在B列中有502000
时,我感兴趣的是将单元格值M划分为B列501000
的单元格值。除了B之外,行的其余部分从A到H是相同的。
现在我正在使用两个for循环,需要100秒才能完成。我正在寻找一个有效的想法。在此先感谢:)
Dim a As Integer, b As Integer
For a = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
For b = a To 2 Step -1
If Cells(a, "A") = Cells(b, "A") And Cells(a, "B") = "502000" _
And Cells(b, "B") = "501000" And Cells(a, "C") = Cells(b, "C") _
And Cells(a, "D") = Cells(b, "D") And Cells(a, "E") = Cells(b, "E") _
And Cells(a, "F") = Cells(b, "F") And Cells(a, "G") = Cells(b, "G") _
And Cells(a, "H") = Cells(b, "H") Then
Cells(a, "P") = Cells(a, "L") / Cells(b, "L")
end if
Next b
Next a