View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Checking for named ranges in a workbook

Hi Chris,

Try something like:

'==========
Sub aTest()
Dim rng As Range
Dim nme As Name

Set rng = ActiveCell '<<==== CHANGE

For Each nme In ActiveWorkbook.Names
If UCase(nme.Name) = UCase(rng.Offset(0, -2).Value) Then
MsgBox "valid name"
Exit Sub
End If
Next nme

MsgBox "No corresponding name found"

End Sub
'<<==========

---
Regards,
Norman



"loopoo" wrote in
message ...

Hello!

Can anyone help me with the following problem:

I have some ranges in my workbook, and I want to check if the content
of a cell is the name of a range.

For example:

I have :
range1
range2
range3
range4
range5

I want to see if ActiveCell.Offset(0,-2).Value is one of the named
ranges in the workbook.

How can I make that check???


Thanks in advance,
Chris


--
loopoo
------------------------------------------------------------------------
loopoo's Profile:
http://www.excelforum.com/member.php...o&userid=28792
View this thread: http://www.excelforum.com/showthread...hreadid=487273