|
本帖最后由 zhang880113 于 2016-4-11 15:26 编辑
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Range("u9") = Range("n9")- Application.Sum(Range("o9:t9"))
End Sub
想把上面的代码用到表格中的第9行以下的所有部份,请老师们修改下,拜托了!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row < 9 Then Exit Sub
If Target.Column <> 15 And Target.Column <> 16 And Target.Column <> 17 And Target.Column <> 18 And Target.Column <> 19 And Target.Column <> 20 Then Exit Sub
r = Target.Row
Cells(r, 21) = Cells(r, 14) - Application.WorksheetFunction.Sum(Range("o" & r & ":" & "t" & r))
End Sub
已解决,谢谢大家!
|
|