Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel MsgBox代码不工作_Excel_Vba - Fatal编程技术网

Excel MsgBox代码不工作

Excel MsgBox代码不工作,excel,vba,Excel,Vba,在宏中,在我的设备上,当我输入带有数字或文本的“MsgBox”时,只要移动到下一行,它就会自动更改为“MsgBox”,执行时,它会在这一行开始给出错误。我该如何解决这个问题 Sub msgbox() msgbox "hello" End Sub 试试这个代码 Sub MsgBox_test() MsgBox "hello" End Sub 在函数中引用相同的函数名称为递归,它需要一个结束条件 任何时候看到递归时,都需要看到一个If语句,该语句为某些参数组合应用一个结束

在宏中,在我的设备上,当我输入带有数字或文本的“MsgBox”时,只要移动到下一行,它就会自动更改为“MsgBox”,执行时,它会在这一行开始给出错误。我该如何解决这个问题

Sub msgbox()

    msgbox "hello"

End Sub
试试这个代码

Sub MsgBox_test()

    MsgBox "hello"

End Sub
在函数中引用相同的函数名称为递归,它需要一个结束条件

任何时候看到递归时,都需要看到一个
If
语句,该语句为某些参数组合应用一个结束情况

递归示例:

Function Fibonacci(ByVal n As Integer) As Integer
    If n <= 2 Then Fibonacci=1 Else Fibonacci=Fibonacci(n-1)+Fibonacci(n-2)
End Function
函数Fibonacci(ByVal n为整数)为整数

如果n将子组件命名为非
msgbox
。谢谢,它工作正常^^