你这个宏是干什么的?怎么cells(i,25),cells(i,27),cells(i,28)这些让单元格反复的赋值,这样反反复复的赋值能不慢吗? 你让这些单元格连续赋值2000多次是想干什么?
Public Sub 更新数据()
For i = 4 To 8124
For j = 4 To 2239
If Cells(i, 1).Value = Cells(j, 40).Value And Cells(i, 2).Value = Cells(j, 41) Then
Cells(i, 25) = Cells(j, 51): Cells(i, 27) = Cells(j, 52): Cells(i, 28) = Cells(j, 46) _
: Cells(i, 29) = Cells(j, 55): Cells(i, 30) = Cells(j, 56): Cells(i, 31) = Cells(j, 58)
GoTo line2
Else
GoTo line1
End If
Cells(i, 25) = Cells(i, 13)
Cells(i, 27).Resize(1, 5).Value = Cells(i, 15).Resize(1, 5).Value
line1:
Next
line2:
Next
End Sub
我稍微改了一下,实在不明白这是什么意思。。你试试看,看改得对不对