Error 438

kobusb

New Member
Joined
May 15, 2011
Messages
9
Office Version
  1. 365
Platform
  1. Windows
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:
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:
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?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,224,587
Messages
6,179,734
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top