Delete name range from selected cells

Reefer

New Member
Joined
Jul 24, 2012
Messages
4
Hi guys,

Hoping someone out there can help me. Think it will be pretty easy but here goes.

Trying to write a macro that will choose a selected range (E2:T200) on a secific worksheet (Edit) and delete the name range for that range without touching the rest of the workbook.

Any help will be muchly appreciated.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try this

Code:
Sub testRemove()
    
    Dim nmWks   As Name
    
    For Each nmWks In ThisWorkbook.Names
        If nmWks.RefersTo = "=Edit!$E$2:$T$200" Then nmWks.Delete
    Next
    
End Sub
 
Upvote 0
Hey Gopala,

I cant seem to get this to work. As i see it, it gets the range but does not delete the name range. Any other ideas?

Reefer
 
Upvote 0

Forum statistics

Threads
1,223,264
Messages
6,171,085
Members
452,378
Latest member
Hoodzy01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top