Other Tips
Sponsored Link

Delete "Defined Name"
2013/02/12
  Delete "Defined Name" in book. There are many meaningless "Defined Name" in old copied books, so Delete them by Macro.
Option Explicit

Private Sub CommandButton1_Click()
    Dim Ans, RefStyle, n
    
    Ans = MsgBox("Execute?", vbYesNo, "Confirm")
    If Ans = vbNo Then Exit Sub
    
    RefStyle = Application.ReferenceStyle
    
    If RefStyle = xlR1C1 Then
        Application.ReferenceStyle = xlA1
    Else
        Application.ReferenceStyle = xlR1C1
    End If

    For Each n In ActiveWorkbook.Names
        If Not n.Name Like "*!Print_Area" And _
            Not n.Name Like "*!Print_Titles" Then
            n.Delete
        End If
    Next

    Application.ReferenceStyle = RefStyle
    
    MsgBox "Finished!"
End Sub
Matched Content
 
Tweet