Signature (Visual Basic / VBA)
Public Function CylinderCalc( _
Optional ByVal vArea As Variant _
, Optional ByVal vDiameter As Variant _
, Optional ByVal vHeight As Variant _
, Optional ByVal vRadius As Variant _
, Optional ByVal vVolume As Variant _
) As Variant
Code Example
CylinderCalc("CALC", Null, 5, 2, Null) = 87.9645943005142
CylinderCalc(vHeight:=5, vRadius:=2, vArea:="CALC") = 87.9645943005142
CylinderCalc(vHeight:=3, vVolume:=10, vDiameter:="CALC") = 2.06012907745701
IsNull(CylinderCalc(vHeight:=3, vArea:=10, vDiameter:="CALC")) = True ' #3
Parameters
| Parameter | Description |
|---|---|
| vArea | Area of the cylinder. |
| vDiameter | Diameter of the base of the cylinder. |
| vHeight | Height of the cylinder. |
| vRadius | Radius of the base of the cylinder. |
| vVolume | Volume of the cylinder. |
Notes & Version History
| Summary | Two of the arguments should contain a numeric value--the given values for those properties. Pass the word "CALC" to the argument whose value is to be calculated and returned by this function. The other arguments should be missing or Null or non-numeric. Function returns Null if it could not calculate the requested property from the values provided. Otherwise, the function returns the value of the property whose argument was passed the word "CALC". |
| Note | This function does not accept all combinations of two known properties; it cannot perform any calculations when given the height and area, or when given the volume and area, as in example #3. |
| Note | Function may return a complex number in the form of a string if the given dimensions are not consistent with the shape. |
| Note | The match on the word "CALC" is case-insensitive, so for example, "CALC" and "Calc" match each other. |