作者:乔山办公网日期:
返回目录:excel表格制作
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Dim i As Integer
Dim x As Integer
For x = 7 To 133 Step 2
For i = 5 To Range("a65536").End(xlUp).Row
Range("H" & i) = Application.WorksheetFunction.SumIf(Range("J2:DZ2"), "进货百", Range("J" & i & ":" & "DZ" & i)) - Application.WorksheetFunction.SumIf(Range("J2:DZ2"), "出货", Range("J" & i & ":" & "DZ" & i)) + Range("f" & i)
Cells(i, x) = Cells(i, x - 1) * Cells(i, 5)
Next
Next
Application.EnableEvents = True
End Sub
加入两行代码度,你再试问试,应该答不再出内现死循环容了。