Tho*_*era 2 excel vba goto excel-vba
我有一个VBA宏,它给了我错误信息.
Sub Function1()
' Give the user macro options based on how fast or slow the computer
' is using advanced conditional compiling
vuserChoice = 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 declare numbers as singles, to speed up the macro.")
MsgBox ("Decimal: recommended for maximum precision. Also slower." & vbNewLine & "Long: not recommended. Rounds to nearest integer." & vbNewLine & "Single: not recommended. A lightweight double." & vbNewLine & "Integer: not recommended. Quick and low-precision.")
If vuserChoice = "Decimal" Or "decimal" Then
GoTo FunctionDecimal
ElseIf vuserChoice = "Double" Or "double" Then
GoTo FunctionDouble
ElseIf vuserChoice = "Single" Or "single" Then
GoTo FunctionSingle
ElseIf vuserChoice = "Long" Or "long" Then
GoTo FunctionLong
Else
GoTo 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
Run Code Online (Sandbox Code Playgroud)
违规行是:
GoTo FunctionNotValidVarType
Run Code Online (Sandbox Code Playgroud)
我有FunctionNotValidVarType这个代码下面的函数.我有它:
Public Sub FunctionNotValidVarType()
MsgBox "VarType " & VarType & " is not supported. Please check spelling."
End Sub
Run Code Online (Sandbox Code Playgroud)
要让第一个功能识别,我需要做FunctionNotValidVarType什么?谢谢.
GoTo 将尝试将代码执行转移到当前子例程中具有给定标签的不同位置.
具体来说,GoTo FunctionNotValidVarType将尝试执行该行:
FunctionNotValidVarType: 'Do stuff here
Run Code Online (Sandbox Code Playgroud)
在您当前的代码中不存在.
如果你想调用另一个函数使用 Call FunctionNotValidVarType
| 归档时间: |
|
| 查看次数: |
27865 次 |
| 最近记录: |