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 |
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 |
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 |
All times are GMT +1. The time now is 02:29 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com