回復 1#myleoyes
你無法取的一個多範圍的值
Sub 提示()
Set c = [G3:G36]
If Application.WorksheetFunction.CountIf(c, "<=0") Then MsgBox "這是極高風險的投資方案!請重新評估!!"
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Base 0 -> 預設的在模組層次中用來宣告陣列索引的預設下限。
Sub 提示A()
Dim myRng(1) As Range '->Dim myRng(0 to 1) As Range
'
'
Dim myRng(2) As Range ->重複宣告變數
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Base 1
Sub 提示A()
Dim myRng(1) As Range '->Dim myRng( 1 to 1) As Range
'
'
Dim myRng(2) As Range ->重複宣告變數 作者: myleoyes 時間: 2011-6-19 22:25
回復 2#GBKEE
GBKEE前輩你好!
良師!辛苦囉!謝謝再三!!
Sub 提示()
Set c = [G3:G36]
If Application.WorksheetFunction.CountIf(c, "<0") Then
MsgBox "這是極高風險的投資方案!請重新評估!!"
End If
Set D = [G37:G84]
If Application.WorksheetFunction.CountIf(D, "<0") Then
MsgBox "這是中度風險的投資方案!請戒急用忍!!"
End If
Set E = [G85:G132]
If Application.WorksheetFunction.CountIf(E, "<0") Then
MsgBox "這是低風險的投資方案!請謹慎應對!!"
End If
End Sub
Option Base 0
Sub 提示A()
Dim myRng(0 To 2) As Range
Set myRng(0) = Range("G3:G36")
Set myRng(1) = Range("G37:G84")
Set myRng(2) = Range("G85:G132")
If Application.WorksheetFunction.CountIf(myRng(0), "<0") Then
MsgBox "這是極高風險的投資方案!請重新評估!!"
ElseIf Application.WorksheetFunction.CountIf(myRng(1), "<0") Then MsgBox "這是中度風險的投資方
案!請戒急用忍!!"
ElseIf Application.WorksheetFunction.CountIf(myRng(2), "<0") Then MsgBox "這是低風險的投資方案