View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Deleting named ranges by looping through range collection

Do you want to:

a. delete the ranges;

b. delete the contents of the ranges; or

c. simply delete the range names?

If you want c., try something like:

Sub DeleteRangeNames()
Dim nm As Name, rng As Range
For Each nm In Names
On Error Resume Next
Set rng = Range(nm)
On Error GoTo 0
If Not rng Is Nothing Then nm.Delete
Set rng = Nothing
Next
End Sub

--

Vasant

"agarwaldvk " wrote in message
...
How could I delete all the named ranges from a workbook using VBA
looping procedures and not individually going through each one of them
from the front end worksheets.

Do we have a range collection as we have collections for other objects
like worksheets and workbooks etc?

Best regards and Thanks

Deepak


---
Message posted from http://www.ExcelForum.com/