|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Target.Row <= 5 Or Target.Row >= 14 Then Exit Sub
Application.EnableEvents = False
If Target.Column = 1 Or Target.Column = 5 Then
r = Target.Row
If Len(Target) = 0 Then
Cells(r, 5) = 0
Else
Set Rng = Sheets("基础资料汇总").Columns(2).Find(Cells(r, 1), lookat:=xlWhole)
If Not Rng Is Nothing Then
m = Rng.Offset(0, 4)
If Cells(r, 5) > m Then
MsgBox "对应数量大于库存:" & m
Cells(r, 5) = ""
End If
Else
MsgBox "对应编号的物料不存在"
End If
End If
End If
Application.EnableEvents = True
End Sub
|
评分
-
1
查看全部评分
-
|