I don't program very much so I am prone to silly errors. I just can't
get the following subprocedure to call my funtion. I keep getting the
"Compile error: Expected Sub, Function, or Property" error message when
the program tries to execute the line:
CheckNumber = CorrectABNDigits(CellContents).
When stepping through the code, the function is highlighted after the
call, so it seems to recognise it, but then it won't step into it,
giving me the same error message over and over. What am I doing wrong?
Why isn't my function a function even if the debugger jumps to it?

I am trying to get the program to read the contents of a cell into
"CellContents", pass this string to the function "Function
CorrectABNDigits(CellContents As String) As Boolean", and then do some
checks on the string. But my sub won't call my function.

Any further comments / criticisms regarding the way I have programmed
this are welcome!

Sub ABNtidy()
Dim CellContents As String
Dim CheckNumber As Boolean

Range("E2").Select
CellContents = Selection.Value
CheckNumber = CorrectABNDigits(CellContents)
MsgBox (CheckNumber)
End Sub

Function CorrectABNDigits(CellContents As String) As Boolean
Dim MyCheck As Boolean

If Len(CellContents) = 11 Then MyCheck '11 characters in cell
CorrectABNDigits = MyCheck
End Function