I know I am missing something but will appreciate a push in the right direction. In Excel 2010 VBA I get error 438 when I call a Sub but not when I call a Function. The following example code illustrates the issue.
When ZZ is a Function it does not give error 438:
When ZZ is a Function it does not give error 438:
Sub tt()
Dim x As Worksheet
Dim a As String
Set x = ActiveSheet
a = ZZ(x)
End Sub
Function ZZ(z As Worksheet)
End Function
When ZZ is a Sub it does give error 438:Dim x As Worksheet
Dim a As String
Set x = ActiveSheet
a = ZZ(x)
End Sub
Function ZZ(z As Worksheet)
End Function
Sub tt()
Dim x As Worksheet
Dim a As String
Set x = ActiveSheet
ZZ (x)
End Sub
Sub ZZ(z As Worksheet)
End Sub
Why does this happen?Dim x As Worksheet
Dim a As String
Set x = ActiveSheet
ZZ (x)
End Sub
Sub ZZ(z As Worksheet)
End Sub