excel中输入数值自动关联变为负数?求解答!
发布网友
发布时间:2022-04-26 21:53
我来回答
共2个回答
热心网友
时间:2023-11-07 13:20
代码
Private Sub Worksheet_Change(ByVal Target As Range)
For i = 1 To 100
If Target.Column = 1 And Target.Cells(i, 1) = "支出" Then
Target.Offset(0, 1) = Target.Cells(1, 2) * -1
End If
Next
For i = 1 To 100
If Target.Column = 1 And Target.Cells(i, 1) = "收入" Then
Target.Offset(0, 1) = Abs(Target.Cells(I, 2))
End If
Next
End Sub
热心网友
时间:2023-11-07 13:20
用VBA代码可以轻松做到。你需要吗
热心网友
时间:2023-11-07 13:20
代码
Private Sub Worksheet_Change(ByVal Target As Range)
For i = 1 To 100
If Target.Column = 1 And Target.Cells(i, 1) = "支出" Then
Target.Offset(0, 1) = Target.Cells(1, 2) * -1
End If
Next
For i = 1 To 100
If Target.Column = 1 And Target.Cells(i, 1) = "收入" Then
Target.Offset(0, 1) = Abs(Target.Cells(I, 2))
End If
Next
End Sub
热心网友
时间:2023-11-07 13:20
用VBA代码可以轻松做到。你需要吗