2015-02-23 63 views
-1

有人能幫我找到這裏的錯誤嗎?如果不是在多種情況下沒有什麼

If Not r Is Nothing Then 
    r.Select 
Else 
If Not rr Is Nothing Then 
    rr.Select 
Else 
If Not rrr Is Nothing Then 
    rrr.Select 
Else 
End If 
+2

什麼是錯誤?你是否遇到錯誤? – 2015-02-23 21:42:56

+1

請更多背景。你的目標是什麼?你的代碼產生了什麼結果? – fjf2002 2015-02-23 21:43:05

回答

5

與您的代碼的問題是,您使用的If Else If代替If ElseIf你需要做的兩種:

If Not r Is Nothing Then 
    r.Select 
Else 
    If Not rr Is Nothing Then 
     rr.Select 
    Else 
     If Not rrr Is Nothing Then 
      rrr.Select 
     Else 
     End If 
    End If 
End If 

或者

If Not r Is Nothing Then 
    r.Select 
ElseIf Not rr Is Nothing Then 
    rr.Select 
ElseIf Not rrr Is Nothing Then 
    rrr.Select 
Else 
End If 

第二個可能是更好的。

+0

第二個是我之後... Thx很多OpiesDad。那很快... – Isu 2015-02-23 22:02:26

相關問題