View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default checking if a range has a name.

Maybe:

Option Explicit
Sub testme()

Dim myName As String
myName = ""
On Error Resume Next
myName = ActiveCell.Name.Name
On Error GoTo 0

If myName = "" Then
MsgBox "no name"
Else
MsgBox "It's: " & myName
End If
End Sub



Peter wrote:

Hello everyone,

Let's say I have given the name "automobile" to cell B7.
If that cell is selected at a certain moment, is is possible to retrieve the
name "automobile" that has been given to it?

I'd like to do something along the lines of (free styling) :
if the name of the active cell =
"automobile" then .... etc. etc.

Does anyone have code for this kind of thing?

Thanks,
Peter


--

Dave Peterson