So, I was going to post a question about how to do this, but while typing my question, I had an idea. And it works. So, I'm posting this in case someone searches for how to do this in the future.
I have numerous workbooks that import lots a a data text file each day. Each time there's an import, it creates a named range called "ExternalData_x" Given that I'm going to have a full year of imports for each workbook, I didn't want to have 365 named ranges, so I was working out how to delete only these ExterenalData named ranges. Here's how to do this:
I have numerous workbooks that import lots a a data text file each day. Each time there's an import, it creates a named range called "ExternalData_x" Given that I'm going to have a full year of imports for each workbook, I didn't want to have 365 named ranges, so I was working out how to delete only these ExterenalData named ranges. Here's how to do this:
VBA Code:
Sub DeleteNamedRanges()
Dim rngName As Name
For Each rngName In ActiveWorkbook.Names
If rngName.Name Like "*ExternalData*" Then
rngName.Delete
End If
Next
End Sub