gpt4 book ai didi

excel - 可以用excel引用外部宏吗?

转载 作者:行者123 更新时间:2023-12-02 18:58:31 24 4
gpt4 key购买 nike

我有一个相当复杂的宏,需要在多个不同的 Excel 工作表上运行,该宏会定期更新,并且每当进行更改时,都需要在每个单独的 Excel 工作表中进行更改。有没有一种方法可以让每个Excel文档引用一个宏?

例如,如果我有这样的层次结构:

    DOCUMENTS:
-xlsheet1.xls
-xlsheet3.xls
-xlsheet2.xls
MACROS:
-macro1.bas

每个工作表中都有一个按钮,单击该按钮即可运行 Macro1。

最佳答案

我建议将该宏移至您的个人文件或创建一个加载项

<小时/>

使用个人文件

主题:在单个工作簿中创建并保存所有宏

链接:https://support.microsoft.com/en-us/office/create-and-save-all-your-macros-in-a-single-workbook-66c97ab3-11c2-44db-b021-ae005a9bc790

引用上述链接:

When you first create a macro in a workbook, it works only in that workbook. But what if you want to use the macro in other workbooks? To make your macros available every time you open Excel, you can create them in a workbook called Personal.xlsb. That’s a hidden workbook stored on your computer, which opens in the background every time you open Excel.

<小时/>

创建加载项

主题:创建 Excel 加载项

链接:http://www.ozgrid.com/VBA/excel-add-in-create.htm

引用上述链接:

I am often asked by users 'what is the best way to distribute their macros?' My answer, is without doubt via an Excel Add-in. After all, this is what Add-ins are for. For those that are not sure what an Excel add-in is, it's is nothing more than an Excel Workbook that has been saved as an Add-in, File>Save as \ Microsoft Excel Add-in (*.xla). Once saved and re-opened the Workbook will be hidden and can only be seen in the "Project Explorer" via the Visual Basic Editor. It is NOT hidden in the same way as the Personal.xls as this can be seen (and made visible) via Windows>Unhide.

关于excel - 可以用excel引用外部宏吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10634345/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com