各位高手Private Sub Worksheet_Change(ByVal Target As Range)帮我解释一下,下面每一句的意思,谢谢哈
PrivateSubWorksheet_Change(ByValTargetAsRange)IfTarget.Column=5AndTarget.Count=1ThenI...
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 5 And Target.Count = 1 Then
If Target.Value > Application.WorksheetFunction.VLookup(Target.Offset(0, -2).Value, Sheets("库存").Range("c3:e100"), 3, 0) Then
MsgBox "领用超量," & Target.Offset(0, -2).Value & "库存只有" & Application.WorksheetFunction.VLookup(Target.Offset(0, -2).Value, Sheets("库存").Range("c3:e100"), 3, 0) & "只"
Target.Value = 0
End If
End If
End Sub 展开
If Target.Column = 5 And Target.Count = 1 Then
If Target.Value > Application.WorksheetFunction.VLookup(Target.Offset(0, -2).Value, Sheets("库存").Range("c3:e100"), 3, 0) Then
MsgBox "领用超量," & Target.Offset(0, -2).Value & "库存只有" & Application.WorksheetFunction.VLookup(Target.Offset(0, -2).Value, Sheets("库存").Range("c3:e100"), 3, 0) & "只"
Target.Value = 0
End If
End If
End Sub 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询