Excel application works on concept of cell which is nothing but intersection of row and column. However a single cell is called as a range which is a most important member of excel object hierarchy. Various formulae in excel application will work on the ranges to get final result. Ranges can be named to a object know as Named Range which will be further used in macro code to perform certain data manipulation.

Sometime, we need to delete specific named range in the workbook which will not be used furthermore. Delete specific named range will be quite time consuming when there are large number named ranges created in the workbook. We can simply automate this task by adding few line of code in macro.









Here is the code which will delete specific named range from the workbook:

Sub Delete_Named_Ranges()
' Author: Dreams24
' Written for VBA Tricks and tips blog
' https://www.vbatricksntips.com

' Declare variable
Dim nRng As Name
Dim rName As String

rName = "Test_Range"

' Loop through all Name ranges in workbook
    For Each nRng In Names
    
        If nRng.Name = rName Then
            nRng.Delete
            MsgBox "Name Range: " & rName & vbNewLine & "    deleted successfully", vbInformation
        End If
        
    Next nRng

End Sub

Share this post if you think this is really useful...