I am just getting started with VBA and working through John Green's Excel 2000 VBA Programmer's Reference text. I'm having trouble getting the last example in the Primer Chapter to work and it's driving me crazy.
If anyone could look at the code and tell me why they think it isn't working I'd greatly appreciate it.
Thanks
Here is the code the book has for the example and what I'm using.
>
Sub TestForName()
If NameExists("SalesData") Then
MsgBox "Name Exists"
Else
MsgBox "Name does not exist"
End If
End Sub
Function NameExists(myName As String) As Boolean
Dim x As String
On Error Resume Next
x = Names(myName).RefersTo
If Err.Number <> 0 Then
NameExists = False
Err.Clear
Else
NameExists = True
End If
End Function
>
No matter what I have in the worksheet I get the False result in the message box stating that the Name Does Not Exist.
HELP!
Bookmarks