ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cell Names (https://www.excelbanter.com/excel-programming/416072-cell-names.html)

Bob[_77_]

Cell Names
 
Hi all:

In excel 2003 VBA, is there a way of knowing if a cell (or groups of cells)
have a name, and if so, what is that name? I know how to get all the
defined names, but not for a particular cell.

Thanks;

Bob



Dave Peterson

Cell Names
 

Dim myRng as range
dim myName as string
set myrng = worksheets("Sheet99").range("a1")

myname = ""
on error resume next
myname = myrng.name.name
on error goto 0

if myname = "" then
msgbox "no name"
else
msgbox myName
end if



Bob wrote:

Hi all:

In excel 2003 VBA, is there a way of knowing if a cell (or groups of cells)
have a name, and if so, what is that name? I know how to get all the
defined names, but not for a particular cell.

Thanks;

Bob


--

Dave Peterson

Bob[_77_]

Cell Names
 
Thanks Dave. I did not know you can use .Name.Name

Bob

"Dave Peterson" wrote in message
...
Dim myRng as range
dim myName as string
set myrng = worksheets("Sheet99").range("a1")

myname = ""
on error resume next
myname = myrng.name.name
on error goto 0

if myname = "" then
msgbox "no name"
else
msgbox myName
end if



Bob wrote:

Hi all:

In excel 2003 VBA, is there a way of knowing if a cell (or groups of
cells)
have a name, and if so, what is that name? I know how to get all the
defined names, but not for a particular cell.

Thanks;

Bob


--

Dave Peterson





All times are GMT +1. The time now is 10:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com