I'm very new to VBA, but the following code produces a 'type mismatch' error (on the 'N' on the call to XLRead) but no error when all lines and references to 'M' are removed:

Dim N,M As Integer
Sub CopyInteger()
XLRead N,M
XLPrint N,M
End Sub
Sub XLRead(N As Integer,M As Integer)
N=Cells(1,2).Value
M=Cells(2,2).Value
End Sub
Sub XLPrint(N As Integer,M As Integer)
Cells(1,3).Value=N
Cells(2,3).Value=M
End Sub

Thanks for any help.
Ken.