'以下代码放在表要的Worksheet_Change事件中
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iR As Integer, iValue As Integer
Dim Vlu
If Target.Column = 1 Then
iR = Target.Row
iValue = Val(Target.Value)
For i = 1 To 3
Vlu = Split(Sheet1.Range("A" & i).Value, "-")
If iValue >= Val(Vlu(0)) And iValue
Sheet1.Range("A" & i).Offset(0, 2).Value = Str(Val(Sheet1.Range("A" & i).Offset(0, 2).Value) - 1)
Target.Offset(0, 1).Value = Sheet1.Range("A" & i).Offset(0, 1).Value
Exit For
Else
Target.Offset(0, 1).Value = "Not found"
End If
Next i
End If
End Sub