File excel của bạn có thể bị nặng nếu chứa nhiều name bị lỗi, tức là các name rỗng hoặc chứa giá trị #REF!. Macro dưới đây sẽ giúp bạn xóa những name bị hỏng này.
Chú ý: Macro này sẽ xóa không cần hỏi tất cả các name bị hỏng trong file excel đang mở.
Your excel file can be so huge if it contains many broken names, this mean named ranges which refer to empty or #REF! ranges. Macro below will help you to delete them.
Note: When you run this macro, it will delete all emtpy or 'broken' named ranges in the entire excel workbook. It will not ask you if you want specific named ranges deleted.
- Mở file excel bạn muốn sử dụng macro này.
Open the Microsoft Excel file in which you would like the Macro to function.
- Nhấn "Alt + F11" để mở Visual Basic Editor.
Press "Alt + F11" to open the Visual Basic Editor.
- Trên Visual Basic Editor, vào menu Insert - Module.
On Visual Basic Editor, click on menu Insert - Module.
- Trong khung soạn thảo của module, copy đoạn mã bên dưới bỏ vào đây:
On Text Box of this module, copy code below and paste here:
Sub Delete_Empty_Named_References()
Dim nName As Name
For Each nName In Names
If InStr(1, nName.RefersTo, "#REF!") > 0 Then
nName.Delete
End If
Next nName
End Sub
- Đóng Visual Basic Editor, trở về Excel, nhấn "Alt+F8" để chạy macro.
Close the Microsoft Visual Basic Editor window, back to Excel window, press "Alt+F8" to run macro.




No comments:
Post a Comment