Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checking for named ranges in a workbook


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checking for named ranges in a workbook


Thanks a lot,

That helped me to do exactly what I wanted.

Chris


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

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
Transfering 100 named ranges to an another workbook Oldjay Excel Discussion (Misc queries) 2 August 8th 07 07:40 PM
Phantom named ranges in a workbook? Dave O Excel Discussion (Misc queries) 3 September 26th 06 05:26 PM
Linking to named ranges in another workbook KG Excel Discussion (Misc queries) 4 March 30th 06 03:07 AM
SQL query a workbook - too many named ranges? Dave[_55_] Excel Programming 0 September 19th 05 06:26 PM
Workbook not recognising named ranges Darin Kramer Excel Programming 2 March 17th 05 04:14 PM


All times are GMT +1. The time now is 07:28 AM.

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"