When I use pre-configured good code, functions in VBA return values. For example, this:
Sub TestFunction() 'Test Function
  MsgBox CheckCell(1)
End Sub
Function CheckCell(CellValue) As Boolean
  If IsNumeric(CellValue) Then
    CheckCell = True
  Else
    CheckCell = False
  End If
End Function
Correctly returns a value of 'True' when run (or, depending on the input 'False', or if modified to be integers, then integers etc).
However, to me, identical looking code that I have written myself:
Sub TestFunction() 'Test Function
MsgBox LastRowInOneColumn()
End Sub
Function LastRowInOneColumn() As Integer
'Find the last used row in Column A
    Dim LastRow As Integer
    With ActiveSheet
        LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
        MsgBox LastRow
        Exit Function
    End With
End Function
Does not work, no matter how I configure it (Adding a return statement, modifying the inputs etc). Why? What is the difference in how I'm performing these two functions?
To answer some obvious things I've checked:
- There are a number of values in the A1 column (14 in my sample). 
- The first message box in the function itself prompts with the correct number, but the value is not returned (Second message box has a value of 0). 
- This seems to happen to all functions I write myself, even though they appear identical to numerous samples I've tried, so I understand I must be the one causing the error.
- I'm using VBA in Excel 2016.
 
    