![]() |
Range Name
I used the following code to get the name of a cell:
dim a as string a = ActiveCell.name.name Can I do something similiar to get the name of a range of cells? Thanks |
Range Name
Are you trying to get a Name or address?
This code get an address a = Selection.Address Use intersect to check if cell is the range of a named item Sub test() For Each nm In ThisWorkbook.Names nmRange = Mid(nm, 2) Set isect = Application.Intersect(Range(nm), ActiveCell) If isect Is Nothing Then MsgBox "Ranges do not intersect" Else MsgBox "Ranges ntersect" End If Next nm End Sub "ranswert" wrote: I used the following code to get the name of a cell: dim a as string a = ActiveCell.name.name Can I do something similiar to get the name of a range of cells? Thanks |
Range Name
Dim A as string
a = "" on error resume next a = activesheet.range("a1:x99").name.name on error goto 0 if a = "" then msgbox "no name for that range" else msgbox a end if ranswert wrote: I used the following code to get the name of a cell: dim a as string a = ActiveCell.name.name Can I do something similiar to get the name of a range of cells? Thanks -- Dave Peterson |
All times are GMT +1. The time now is 05:51 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com