VBA“编译错误:参数不可选” Excel 中文网

您所在的位置:网站首页 vba编译错误参数不可选的原因 VBA“编译错误:参数不可选” Excel 中文网

VBA“编译错误:参数不可选” Excel 中文网

2024-07-12 07:10| 来源: 网络整理| 查看: 265

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 VBA Excel文件不编译:子或function未定义 如果单元格是偶数或奇数,Excel将执行加法 如何在图表上以编程方式设置X轴?如何在Aspose中删除范围(使用C#)仅当数据项存在3次或更多次时才显示使用Excel2000单元中的ExcelApp.Caller如何在Open XML SDK中有效地caching和刷新stream将两行合并为一个基于匹配的ref很慢VBA Excel:指定的维度对当前图表types无效自动将命令button链接到单元格值如何从macros菜单栏捕捉“打印”button


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3