在excel中工作宏工作时,如何执行此任务?

在excel中工作宏工作时,如何执行此任务?,excel,vba,Excel,Vba,正如我们所知,通常在宏运行之后和宏完成之前,我们无法在此excel文档中执行任何操作。 这有时有点不方便,而且(让我们想象一下)我不想等待很长时间,在同一个文档中并行地做一些事情会很好。 可能吗?如果是,如何进行?否,这是不可能的 Excel不支持在辅助线程中运行宏,因此无法按要求执行。原因很清楚-如果宏正在运行时用户可以编辑/插入/删除的单元格上执行操作,当这会影响宏的行为时,它将如何工作?否,尽管下面的链接中描述了一种可能的解决方法,可能会有所帮助 也许您可以尝试使用应用程序来执行某些操作。

正如我们所知,通常在宏运行之后和宏完成之前,我们无法在此excel文档中执行任何操作。 这有时有点不方便,而且(让我们想象一下)我不想等待很长时间,在同一个文档中并行地做一些事情会很好。
可能吗?如果是,如何进行?

否,这是不可能的


Excel不支持在辅助线程中运行宏,因此无法按要求执行。原因很清楚-如果宏正在运行时用户可以编辑/插入/删除的单元格上执行操作,当这会影响宏的行为时,它将如何工作?

否,尽管下面的链接中描述了一种可能的解决方法,可能会有所帮助


也许您可以尝试使用应用程序来执行某些操作。ontime,但您应该尝试不使用宏来选择单元格和工作表,例如:工作表(1)。激活,范围(“A1”)。选择。例如,您可以使用Application.ontime制作一个计时器,并继续在单元格中选择或插入值。

在代码之间插入事件

Sub test2()

    Do
     '.....

     DoEvents '<~ While the macro is running you can do other things in the Excel document.
    Loop
End Sub
子测试2()
做
'.....

DoEvents的Excel/VBA绝对不是一种多线程技术/解决方案。如果必须并行运行多个Excel进程,请考虑启动Excel的一个或多个新实例。
Opening a second instance of Microsoft Excel causes Windows to load a new copy of the program into memory. This can be useful when you find yourself waiting a long time for Excel to complete complex operations in a large spreadsheet. Opening a second instance of Excel allows you to work with on a different spreadsheet while the first instance of the program is busy.

Desktop View
1.    Open your first instance of Excel, and then right-click the Excel icon on the Desktop taskbar.
2.    Hold down the "Alt" key and select "Excel 2013" from the pop-up menu.
3.    Continue holding down the "Alt" key until you see a prompt asking you if you want to start a new instance of Excel. Click "Yes" to open the new instance.

Start Screen
1.    Open your first instance of Excel, and then right-click the Excel tile on the Start screen.
2.    Hold down the "Alt" key and click "Open New Window" on the Start screen taskbar.
3.    Continue holding down the "Alt" key until you see a prompt asking you if you want to start a new instance of Excel. Click "Yes" to open the new instance.
现在,当您打开任务管理器时,您会看到两个Excel实例正在运行


您可以在这两个Excel实例中并行运行这两个作业/任务

我通读了这篇文章,但在我看来这是一条很难的路。我的任务不值得这样冒险:-)谢谢anyway@UmrbekMatrasulov我同意肯的观点。事实上,我提到过这一点,您可以在单独的Excel实例中工作,但说真的,这仍然是一种不可靠的方式。