所以我有一个单元格(A2),里面有一个整数值(5)。我想要一个查看单元格的 switch 语句,然后如果该单元格的值大于 50000 做某事,如果该值小于 50000 做某事。
这是我的代码不起作用,它表示代码行“溢出” threshold = 50000
:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim state As Integer
Dim threshold As Integer
threshold = 50000
state = Sheet1.Range("A2").Value
Select Case state
Case state < threshold
'Do something
Debug.Print (state)
Case Is >= threshold
'Do something
Debug.Print (state)
End Select
End Sub
我怎样才能解决这个问题?