以下代码有问题。当用户在 range 中输入值 9 或 10 时,它会正确显示 InputBox J1:J503
,但 InputBox 输出没有按我的意图显示在 L 列中。为什么?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim vrange As Range, cell As Range
Dim TheAnswer$
Set vrange = Range("J1:J503")
If Intersect(vrange, Target) Is Nothing Then Exit Sub
For Each cell In Intersect(vrange, Target)
If cell.Value = 9 Or cell.Value = 10 Then
Target.Offset(0, 2).Select
TheAnswer = InputBox("Please put comments", "Comments required for option 9 and 10")
End If
Next cell
End Sub