0
任何人都可以幫我用我的循環?Excel VBA雖然循環
Dim Lastrow As Long
Dim i As Variant
Dim Valid As Boolean
Dim inputDec As Integer
Lastrow = Range("D65000").End(xlUp).Row
While Valid = False
i = InputBox("Ve kterém sloupci je datum? (A=1,B=2,C=3, atd..)", "Datum")
If IsNumeric(i) Then
Valid = True
Else
Valid = False
MsgBox ("Zadejte číslo sloupce! (A=1,B=2,C=3, atd..)")
End If
Wend
不能輸入字母等。但問題是,你可以輸入< 0。我是想這樣的代碼
If IsNumeric(i) And ">0" Then
但是,這並不工作,並在錯誤結束,可以有人幫助我嗎?
'如果則IsNumeric(i)和I> 0,則'?有點不直觀,你不能只做'如果X是Y和Z',你必須做'如果X是Y而X是Z'(顯然是僞代碼)。你必須每次都充分表達情況。 – BruceWayne
強制用戶輸入數字的替代方法是僅使用字母(例如'Cells(5,「D」)'是有效的),或者如果您確實需要列**數字**,則使用類似於'列( 「d」)。Column'。 – YowE3K