2011-06-15 81 views
2

如果我有以下代碼:Excel VBA中調用選擇情況下的多個子例程

Select Case Number 

    Case 1: Call Subroutine1() 
    Case 2: Call Subroutine2() 
    Case 3: Call Subroutine3() 
    Case 4: Call Subroutine4() 
    Case 5: Call Subroutine5() 
    Case 6: Call Subroutine6() 

End Select 

,我想打電話給幾個子程序的情況下,1:

如何能不能做到?

最好的,美國

回答

3
Select Case Number 

    Case 1: 
    Call Subroutine1a() 
    Call Subroutine1b() 
    Call Subroutine1c() 

    Case 2: Call Subroutine2() 
    Case 3: Call Subroutine3() 
    Case 4: Call Subroutine4() 
    Case 5: Call Subroutine5() 
    Case 6: Call Subroutine6() 

End Select 
+0

thx。它做到了。 – user366121 2011-06-15 13:49:12

0

像這樣:

Select Case Number 

    Case 1: 
     Call Subroutine1a() 
     Call Subroutine1b() 
    Case 2: Call Subroutine2() 
    Case 3: Call Subroutine3() 
    Case 4: Call Subroutine4() 
    Case 5: Call Subroutine5() 
    Case 6: Call Subroutine6() 

End Select 
-1

你可以有很多說法在每種情況下的比賽,只要你喜歡;

Select Case Number 
    Case 1 
    Call Subroutine1() 
    Call Subroutine2() 
    Case 2: Call Subroutine2() 
    ...