gpt4 book ai didi

vba - 有人可以帮助调试这个 Select Case

转载 作者:行者123 更新时间:2023-12-02 06:46:53 25 4
gpt4 key购买 nike

我已经做了一段时间,但没有成功。

它不会显示任何其他结果,除了前两种情况和最后一种情况。

我试过小于等于的情况。

        Dim DayLeft As Long
DaysLeft = Me.Days.Value

Select Case DaysLeft
Case Is = 0
MsgBox "Deadline due today!"
Case Is < 0
MsgBox "Deadline expired!"
Case 90 To 31
MsgBox "First notice " & Me.Days& " days until deadline!"
Case 30 To 11
MsgBox "Deadline due soon! " & Me.Days & " days until deadline!"
Case Is <= 10
MsgBox "Warning! " & Me.Days& " days until deadline!"
End Select

最佳答案

来自Select Case文档:

The To keyword specifies a range of values. If you use the To keyword, the smaller value must appear before To.

所以你需要

Case 31 to 90
...
Case 11 to 30

关于vba - 有人可以帮助调试这个 Select Case,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58223832/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com