Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
plh plh is offline
external usenet poster
 
Posts: 48
Default See if a Range Name exists?

Dear Gurus,
I need to find a way to inquire whether or no a given range name exists, without
generating and error. Something like:

If (Sheets("MySheet").Names("MyRangeName")) EXISTS then
DoSomething
End if

I tried
If IsError(Sheets("MySheet").Names("MyRangeName").Del ete) Then
DoSomething
End If

And many variations on that theme but this just generates the error as if I
said:
Sheets("MySheet").Names("MyRangeName").Delete
by itself when that name is not in existence.

The error that this does generate, "Application Defined" is so broad that
trapping it is not really an option, because it has such a large probability of
Beta Error, if you will.

So: is there some way to test and see if a given range name exists?
Thank You,
-plh


--
I keep hitting "Esc" -- but I'm still here!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default See if a Range Name exists?


this is from yesterdays post, for the same question


http://tinyurl.com/ryc7

--
davesexce

-----------------------------------------------------------------------
davesexcel's Profile: http://www.excelforum.com/member.php...fo&userid=3170
View this thread: http://www.excelforum.com/showthread.php?threadid=53762

  #3   Report Post  
Posted to microsoft.public.excel.programming
plh plh is offline
external usenet poster
 
Posts: 48
Default See if a Range Name exists?

In article , davesexcel
says...


this is from yesterdays post, for the same question


http://tinyurl.com/ryc7r


Thank you so much, Dave.
I had searched before posting but did not see anything.
-plh


--
I keep hitting "Esc" -- but I'm still here!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default See if a Range Name exists?

Function RngNameExists(strName As String) As Boolean
For Each strRngName In ThisWorkbook.Names
If strRngName.NameLocal = strName Then
RngNameExists = True
Exit Function
Else
RngNameExists = False
End If
Next strRngName
End Function


Steve



"plh" wrote in message
...
Dear Gurus,
I need to find a way to inquire whether or no a given range name exists,
without
generating and error. Something like:

If (Sheets("MySheet").Names("MyRangeName")) EXISTS then
DoSomething
End if

I tried
If IsError(Sheets("MySheet").Names("MyRangeName").Del ete) Then
DoSomething
End If

And many variations on that theme but this just generates the error as if
I
said:
Sheets("MySheet").Names("MyRangeName").Delete
by itself when that name is not in existence.

The error that this does generate, "Application Defined" is so broad that
trapping it is not really an option, because it has such a large
probability of
Beta Error, if you will.

So: is there some way to test and see if a given range name exists?
Thank You,
-plh


--
I keep hitting "Esc" -- but I'm still here!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to lookup if value exists in a range of data? S.elhalaby Excel Worksheet Functions 3 May 5th 23 07:43 PM
Validate Named Range Exists John Jost Excel Programming 5 December 5th 05 08:17 PM
Check if a number exists in a range? gkaste Excel Discussion (Misc queries) 2 July 13th 05 08:00 PM
how to tell if a named range exists Gixxer_J_97[_2_] Excel Programming 2 June 1st 05 07:38 PM
Checking to see if a Range Object exists? debartsa Excel Programming 2 January 20th 04 06:13 PM


All times are GMT +1. The time now is 12:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"