简体   繁体   English

Excel:用宏重新创建工作表吗?

[英]Excel: Recreating a Sheet with a Macro?

I'm looking for a simple way to recreate a relatively complex Excel sheet with a macro, inculding cell values, formulas, formatting, and cell size. 我正在寻找一种简单的方法来重新创建带有宏的相对复杂的Excel工作表,包括单元格值,公式,格式和单元格大小。

Basically, I have an Excel sheet and I need the VB code that would create the sheet. 基本上,我有一个Excel工作表,并且需要用于创建工作表的VB代码。 Ie somewhat like using the macro recorder, but without having to do all the steps in sequence. 即有点像使用宏记录器,但不必依次执行所有步骤。

Any ideas? 有任何想法吗?

(Copying from a template xls would be much more convenient, of course, but I'm limited to code and can't use additional files in production, for now). (当然,从模板xls复制会更加方便,但是我仅限于代码,暂时无法在生产环境中使用其他文件)。

If you don't want to use additional files, put your template as a separate sheet in the same XLS where your macro resides. 如果您不想使用其他文件,请将模板作为单独的工作表放在宏所在的同一XLS中。 IMHO, you should avoid having to recreate a complete sheet by code, at least for maintenance reasons. 恕我直言,至少出于维护原因,您应避免通过代码重新创建完整的图纸。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM