Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Sub test()
Dim oWB As Workbook
Dim sName As String
Set oWB = ActiveWorkbook ' will need to change this if to be used from VB6 instead of Excel VBA
sName = "justin"
If NameExists(sName, oWB) Then
MsgBox oWB.Names(sName).RefersToR1C1
Else
MsgBox "'" & sName & "' is not a valid name"
End If
sName = "me"
If NameExists(sName, oWB) Then
MsgBox oWB.Names(sName).RefersToR1C1
Else
MsgBox "'" & sName & "' is not a valid name"
End If
End Sub
Private Function NameExists(sName As String, oWB As Workbook) As Boolean
Dim n As Long
Dim i As Long
With oWB.Names
n = .Count
For i = 1 To n
If sName = .Item(i).Name Then
NameExists = True
Exit For
End If
Next i
End With
End Function