VBA“编译错误:参数不可选”
我有一个VBAmacrosselect其他计算用户的数据types的select。
Sub Function1() ' Give the user macro options based on how fast or slow the computer is using advanced conditional compliling MsgBox ("This macro by default treats all numbers as decimals for maximum precision. If you are running this macro on an old computer, you may want to relare numbers as singles, to speed up the macro.") MsgBox ("Decimals are reccomended for any scientific conclusions.") MsgBox ("Decimal: reccomended for maximum precision. Also slower." & vbNewLine & "Double: not reccomended." & vbNewLine & "Single: not reccomended. A lightweight double." & vbNewLine & "Long: rounds to nearest number. Massive range of possible values." & vbNewLine & "Integer: designed for quick estimates of data.") vuserChoice = InputBox("Select a data type:" & vbNewLine & "1. Decimal" & vbNewLine & "2. Long" & vbNewLine & "3. Single" & vbNewLine & "5. Integer") Select Case IsNumeric(vuserChoice) Case IsNumeric = True MsgBox ("A number cannot be entered for data type.") Case IsNumeric = False struserChoice = CStr(vuserChoice) If struserChoice = "Decimal" Or "decimal" Or "1" Or "one" Or "on" Or "Dec" Or "dec" Then Call FunctionDecimal ElseIf struserChoice = "Double" Or "double" Or "2" Or "two" Or "to" Then FunctionDouble ElseIf struserChoice = "Single" Or "single" Or "3" Or "three" Or "three" Or "thee" Then FunctionSingle ElseIf struserChoice = "Long" Or "long" Or "4" Or "four" Or "for" Or "foor" Then FunctionLong ElseIf struserChoice = "Integer" Or "integer" Or "int" Then FunctionInteger Else FunctionNotValidVarType End If ' MEeff = measure of efflux due to crudely purified HDL in scintillation MsgBox "For additional information about this macro:" & vbNewLine & "1. Go to tab Developer" & vbNewLine & "2. Select Visual Basic or Macro." & vbNewLine & "See the comments or MsgBoxes (message boxes)." End Sub
这是违规的代码行:
Case IsNumeric = True
我需要做什么来解决这个问题? 我知道IsNumeric是一个内置的VBAfunction。
案例标签应该是值,而不是函数名称。 尝试
Case True