1
I'm cleaning up a bloated Excel workbook and am trying to bulk delete named ranges that are referring to workbooks on someones 'C' drive. There are a lot of them. And they are not being used in this Workbook.
'C:\blahblah\...\...\...\...\...\[WorkBookName.xls]Sheet1'!$E$28
The code below helped me delete named ranges where their name contains 'icon' (for example).
However, I really need to delete the range when it contains a path as shown above. Bearing in mind that the Workbook or Sheet name could also change, but the drive remains the same.
Sub deleteNamedRangesSpecific()
For Each NR In ActiveWorkbook.Names
If NR.NameLocal Like "*" & "icon" & "*" Then NR.delete
Next
End Sub
Any ideas how to delete according to the range itself, not the name of the range?
Thanks.
Mike.
If ... Then Range(nr).ClearContents
? Or.Delete
if you want to remove the cells/rows – BruceWayne – 2017-07-21T17:40:57.220