发布网友 发布时间:2022-04-23 03:00
共2个回答
热心网友 时间:2023-08-24 13:54
'以下代码放在表要的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 <= Val(Vlu(1)) Then
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
热心网友 时间:2023-08-24 13:55
表一表二截图传上来看看,描述的看不懂