Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for Named Ranges
Hello all,
I had this macro that deleted the Named Range "Table1" at the beginning of it and then redefined it (added it) and the end of the code. The problem is that one time through the code, it hit a snag. So after I stopped execution, Table1 is was no longer defined. The very next time through the code, it snagged on deleting Named Range "Table1". How would I test to see if the named range even exists before I try to delete it? Thanks for any help anyone can provide, Conan Kelly |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for Named Ranges
on error resume next
.....delete the range on error goto 0 Tim "Conan Kelly" <CTBarbarin at msn dot com wrote in message ... Hello all, I had this macro that deleted the Named Range "Table1" at the beginning of it and then redefined it (added it) and the end of the code. The problem is that one time through the code, it hit a snag. So after I stopped execution, Table1 is was no longer defined. The very next time through the code, it snagged on deleting Named Range "Table1". How would I test to see if the named range even exists before I try to delete it? Thanks for any help anyone can provide, Conan Kelly |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Testing for Named Ranges
This will test for names in workbook:
Sub names() Dim n As String Dim s As name n = "Table1" For Each s In ThisWorkbook.names If s.name = n Then MsgBox ("Found " & n) Next s End Sub Mike F "Conan Kelly" <CTBarbarin at msn dot com wrote in message ... Hello all, I had this macro that deleted the Named Range "Table1" at the beginning of it and then redefined it (added it) and the end of the code. The problem is that one time through the code, it hit a snag. So after I stopped execution, Table1 is was no longer defined. The very next time through the code, it snagged on deleting Named Range "Table1". How would I test to see if the named range even exists before I try to delete it? Thanks for any help anyone can provide, Conan Kelly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Testing selection against named range | Excel Discussion (Misc queries) | |||
Like 123, allow named ranges, and print named ranges | Excel Discussion (Misc queries) | |||
Testing for named cells (i.e., ranges) | Excel Programming | |||
Named Ranges | Excel Worksheet Functions | |||
named ranges - changing ranges with month selected | Excel Programming |