如何使用消息框打开一组新代码并运行它?



所以我一直在做的是运行我的第一组代码,它将打开具有特定数据的新工作簿,然后将不同的代码粘贴到制作的新工作簿中并运行它。

我想知道是否有办法在第一组代码中使用消息框来运行最后的第二组代码?

MsgBox "Would you like to populate the team lists?", vbOKCancel
If Result = vbYes Then

需要知道该放入Then什么.我知道我可以把代码放在Then但它是 2000 行,所以我希望它可以在其他地方运行。

你可以这样做:

If MsgBox("Would you like to populate the team lists?", vbOKCancel) = vbOK Then
'run your code
End If

最新更新