简体   繁体   中英

Prevent UDF from being called on vba Excel Sheet Deletion/Addition

Before Deletion and Creation of Worksheets using

Sheets(xxx).Delete 

or

Worksheets.Add(Before:=Worksheets(xxx)).Name = xxxxxx

User Defined Functions(UDF) are being called.

Is there a way to prevent UDF being called. I just want to create or delete a sheet

When Excel is in Automatic calculation mode deleting a worksheet triggers a recalculation.
If your UDFs are Volatile or downstream dependent on a volatile function or a cell on the deleted worksheet they will be recalculated.
See http://www.decisionmodels.com/calcsecretsi.htm for more information on volatile functions and actions that trigger a recalculation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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