G
Grant Reid
Hi
I hope someone can help me ou there. I'm trying to delete all named ranges
in all Worksheets, except one named "Connection Data", but I don't seem to
having any success. I have pasted my code below. If anyone can enlighten me
as to where I'm going wrong, it would be much appreciated.
Many Thanks - Grant
Sub DeleteRanges()
Dim WSh As Worksheet
Dim nm As Name
'----------------------------
'Delete All Named Ranges Except Named Ranges "In Connection Data" Workbook
'----------------------------
For Each WSh In ThisWorkbook.Worksheets
If Not WSh.Name Like "Connection Data" Then
For Each nm In ActiveWorkbook.Names
nm.Delete
Next nm
End If
Next WSh
End Sub
I hope someone can help me ou there. I'm trying to delete all named ranges
in all Worksheets, except one named "Connection Data", but I don't seem to
having any success. I have pasted my code below. If anyone can enlighten me
as to where I'm going wrong, it would be much appreciated.
Many Thanks - Grant
Sub DeleteRanges()
Dim WSh As Worksheet
Dim nm As Name
'----------------------------
'Delete All Named Ranges Except Named Ranges "In Connection Data" Workbook
'----------------------------
For Each WSh In ThisWorkbook.Worksheets
If Not WSh.Name Like "Connection Data" Then
For Each nm In ActiveWorkbook.Names
nm.Delete
Next nm
End If
Next WSh
End Sub