title: "Object Required" when calling function in sub in VBA Excel
body: <p>In my VBA program for excel; I have a function called "ParamCheck" which get four "double" variables, checks them and returns a message as "string".</p>
  
  <pre><code>Function ParamCheck(airSpeed As Double, FCUvalue As Double, _
              altitude As Double, terrainElevation As Double) As String
  
              If airSpeed &lt; MIN_CONTROL_SPEED Then                            
              'check if airspeed is less than 119 ft/min or not
                  ParamCheck = "Airspeed is less than minimum control speed"
  
              ElseIf FCUvalue &gt; FCU_VALUE_LIMIT Then                          
              'check if FCU value if greater than 10 or not
                  ParamCheck = "FCU value is greater than limit"
  
              ElseIf FCUvalue &lt; 0 Then                                        
              'check if FCU vlaue is negative or not
                  ParamCheck = "FCU value is negative"
  
              ElseIf altitude &lt;= terrainElevation Then                        
              'check if altitude is greater that terrain of elevation or not
                  ParamCheck = "Altitude is less than terrain elevation"
  
              Else                                                            
              'if all the parameters are valid print a "Valid" message
                  ParamCheck = PARAMS_OK
              End If
  End Function
  </code></pre>
  
  <p>and now I need to call this function in my sub program. Here is the code</p>
  
  <pre><code>Dim checkParam As String    ' result of validity check of parameters
  Set checkParam = ParamCheck(speedAir, valueFCU, aboveSea, elevationTerrain)
  </code></pre>
  
  <p>when running it gives me this error "object required" and highlights "checkParam"</p>