Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hello Everyone,
I'm not very good at VBA, hiowever, I do have to occaisionally use it. Is there a way to programatically test for a range name and then delete it if it exists? Many thank in advance! John |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
If you know you want to delete the name, just delete it and ignore any error.
on error resume next activeworkbook.names("somenamehere").delete on error goto 0 JCS wrote: Hello Everyone, I'm not very good at VBA, hiowever, I do have to occaisionally use it. Is there a way to programatically test for a range name and then delete it if it exists? Many thank in advance! John -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
try this
Sub sonic() Dim RngTest As Range Set RngTest = Range("Myrange") On Error GoTo 0 If RngTest Is Nothing Then MsgBox "Its not there" Else RngTest.Delete End If End Sub Mike "JCS" wrote: Hello Everyone, I'm not very good at VBA, hiowever, I do have to occaisionally use it. Is there a way to programatically test for a range name and then delete it if it exists? Many thank in advance! John |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Dave/Mike
Thank you very much. I tried both methods and both work great!!!! John "JCS" wrote: Hello Everyone, I'm not very good at VBA, hiowever, I do have to occaisionally use it. Is there a way to programatically test for a range name and then delete it if it exists? Many thank in advance! John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
TESTING | Excel Worksheet Functions | |||
Confused with RangeName CellREfs | Excel Discussion (Misc queries) | |||
ActiveWorkbook.Protect password:=range("rangename") does not work | Excel Discussion (Misc queries) | |||
Testing | Excel Discussion (Misc queries) | |||
Concatenate RangeName for INDEX? | Excel Worksheet Functions |