如何通过Excel VBA中的Select Case?

Kev*_*oyd 6 excel vba office-2007 excel-vba

特定

Select Case cmd

    case "ONE":   MsgBox "one"

    case "TWO":   MsgBox "two"

    case "THREE": MsgBox "three"

End select
Run Code Online (Sandbox Code Playgroud)

我的要求是,如果cmd = "ONE"我需要 "one"然后"two"显示但是目前我正在"one"显示,然后该程序突破了选择案例...

man*_*nji 15

Select Case cmd
    case "ONE", "TWO":   
                  if cmd = "ONE" THEN
                      MsgBox "one"
                  end if
                  MsgBox "two"

    case "THREE": MsgBox "three"

End select
Run Code Online (Sandbox Code Playgroud)

  • 只是为了快速读者清楚:这不是通过. (6认同)