excel - 如何确定一个宏是否被excel中的另一个宏调用,并相应地执行代码
问题描述
这只是我想做的一个例子。我有一个精心制作的宏,我想做不同的事情,具体取决于它是否被另一个宏调用。
sub Example()
Call MyCode
end sub
sub MyCode()
If Called by Example GoTo SkipNextLine
Do these things
exit sub
SkipNextLine:
Do other things
end sub
解决方案
一个简单的方法是使用参数和参数。
Sub Example()
Call MyCode("Example")
End Sub
Sub Example2()
Call MyCode("Example2")
End Sub
Sub MyCode(Origin as String)
Select Case Origin
Case "Example"
'Do stuff here
Case "Example2"
'Do other stuff here
End Select
End Sub
推荐阅读
- css - 在Bootstrap中将8张相同大小的卡片放在一行中
- angular - 发生未处理的异常:未在工作区中设置配置“es”
- python - 减少python中的图像通道
- python - python zipline:如何使用分钟数据导入数据包
- html - Outlook HTML 签名格式
- python - 从 Django 中的按钮获取 URL 参数
- javascript - 如何在 Typescript 中对重载函数进行命名导出?
- javascript - 如何从此 NodeList 中提取数据?
- csv - Racket:在函数中使用“csv-reading”包
- docker - docker 限制容器网络访问