user4974730
user4974730

Reputation:

VBA "Compile error: Argument not optional" debugging sub

I am trying to debug this simple section of code:

Public Sub FunctionNotValidVarType()
MsgBox "VarType " & VarType & " is not supported. Please check spelling."
End Sub

Upvotes: 1

Views: 790

Answers (1)

Gotrekk
Gotrekk

Reputation: 494

Public Sub FunctionNotValidVarType()
Dim variable As Integer
variable = 2
MsgBox "VarType " & VarType(variable) & " is not supported. Please check spelling."
End Sub

You need to call the VarType function passing to it an actual variable

Upvotes: 1

Related Questions