I created the following function to check wether a given word is a palindrome and send back true or false. However, the function return #NAME! . Hereby the code:
Option explicit
Public Function palindrome(txt As String) As Boolean
Dim xend As Long
Dim xstrt As Long
Dim i As Long
xend = Len(txt)
xstrt = 1
For i = 1 To xend \ 2
If Mid(txt, xstrt, 1) <> Mid(txt, xend - i + 1, 1) Then
palindrome = False
Exit Function
End If
palindrome = True
Next i
End Function
Thank you in advance for your help.