我有一个来自Module1的宏(名称为Test(((,通常要调用这个宏,我使用的代码是:
调用模块1.测试
但我正在寻找一个VBA代码来从Module1调用我的宏测试,直到某些代码行
示例:当宏到达900 行时停止运行
感谢您的帮助
我不确定,但我可以猜测您可能想在不同的部分运行Test((子例程:
Sub Test(Optional stop_at_900 = False)
Debug.Print vbTab & "do the first part of the code"
'other code
900: If stop_at_900 Then Exit Sub ' 900 label is not needed, it is placed here for labeling
Debug.Print vbTab & "do the rest of the code"
'other code
End Sub
Sub UsageExample()
Debug.Print "Doing full Test() code..." ' usual (full) use
Call Test
Debug.Print "Doing Test() code until 900 line..." '
Call Test(stop_at_900:=True) 'partial use
End Sub