Excel undo button

末鹿安然 提交于 2020-01-07 02:59:28

问题


When I change some value in my cell, the undo option is not available. Is it because I have vba programming code in background and how can I enable undo?

Another question. When I try to save excel file it offers me xltm format. Since I don't have any macro (but i have vba code) i have saved it as xlsx. It looks that everything works for now, also vba code in background. What is the difference between xltm and xlsx format if there is any?


回答1:


Are you changing the cell value using code?

Regarding the file types, xltm will almost certainly be a Macro-enabled template. From 2007 onwards the two main file types are xlsx and xlsm. XLSX, will not contain any VBA, XLSM are Macro-Enabled and can contain VBA.




回答2:


Unfortunately, after running a macro, the cached info for the Undo is erased. It is how Excel+Vba works.

However, inside a procedure(Vba) and before it ends, you can use the line Application.Undo to undo the last action. But as soon as the VBA procedure ends and returns control to Excel, there is no Undo anymore.

XLSM is the file format that allows the spreadsheet to have macros. XLSX is the spreadsheet file format without macros. No .xlsx file can have macros.

In your case probably the code is inside an Add-In or in the personal.xlsb file. In such a case, the vba code is available to use in any Excel file regardless of it being .xlsm, .xlsx, etc.



来源:https://stackoverflow.com/questions/14724480/excel-undo-button

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!