M
Mike Piazza
I am trying to write a macro to delete the unused defined names in a
workbook. I am looking for a way to test if the name is used in the workbook
somewhere and if it is a print area... I was hoping to come up with some sort
of if statement to accomplish this and put it below in the [New Code]
placeholder. Thanks for the help.
Sub DeleteNames()
'
' DeleteNames Macro
' Macro Written 5/12/2005 by MRP
'
Dim rng As Range
Dim ThisName As Name
Msg = "This Macro will delete all unused Defined Names in this workbook.
Are you sure you wish to proceed?"
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbYes Then
For Each ThisName In ActiveWorkbook.Names
[New Code]
ThisName.Delete
Next ThisName
End If
End Sub
workbook. I am looking for a way to test if the name is used in the workbook
somewhere and if it is a print area... I was hoping to come up with some sort
of if statement to accomplish this and put it below in the [New Code]
placeholder. Thanks for the help.
Sub DeleteNames()
'
' DeleteNames Macro
' Macro Written 5/12/2005 by MRP
'
Dim rng As Range
Dim ThisName As Name
Msg = "This Macro will delete all unused Defined Names in this workbook.
Are you sure you wish to proceed?"
Ans = MsgBox(Msg, vbYesNo)
If Ans = vbYes Then
For Each ThisName In ActiveWorkbook.Names
[New Code]
ThisName.Delete
Next ThisName
End If
End Sub