K
Kev
I am trying to selectively delete defined names from an excel workbook. The
problem stems from copying excel sheets from file A to file B as it also
copys the list of defined names to file B even though file B does not
reference these defined names. I now have files with 30,000+ unused defined
names.
I can delete all names using code such as
Dim x%
For x = 1 To ActiveWorkbook.Names.Count - y + 1
ActiveWorkbook.Names(x).Delete
x = 1
y = y + 1
Next
However I would like to selectively delete defined names if and only if they
are not referenced in the workbook. I have tried using
Worksheetfunction.find, howevere if the defined name is not found it causes
an error in the Macro. I have used the on error / go to functions but it only
seams to work once (error occurs the second time a defined name is not found).
Any help would be greatly appreciated.
Thanks
problem stems from copying excel sheets from file A to file B as it also
copys the list of defined names to file B even though file B does not
reference these defined names. I now have files with 30,000+ unused defined
names.
I can delete all names using code such as
Dim x%
For x = 1 To ActiveWorkbook.Names.Count - y + 1
ActiveWorkbook.Names(x).Delete
x = 1
y = y + 1
Next
However I would like to selectively delete defined names if and only if they
are not referenced in the workbook. I have tried using
Worksheetfunction.find, howevere if the defined name is not found it causes
an error in the Macro. I have used the on error / go to functions but it only
seams to work once (error occurs the second time a defined name is not found).
Any help would be greatly appreciated.
Thanks