Signature (Visual Basic / VBA)
Public Function SquareCalc( _
Optional ByVal vArea As Variant _
, Optional ByVal vDiagonal As Variant _
, Optional ByVal vPerimeter As Variant _
, Optional ByVal vSide As Variant _
) As Variant
Code Example
SquareCalc(34, "CALC", Null, Null) = 8.24621125123532
SquareCalc(Null, 20, "CALC", Null) = 56.5685424949238
SquareCalc("CALC", Null, 30, Null) = 56.25
SquareCalc(Null, Null, 30, "CALC") = 7.5
SquareCalc(vPerimeter:=30, vSide:="CALC") = 7.5
Parameters
| Parameter | Description |
|---|---|
| vArea | Area of the square. |
| vDiagonal | Length of the diagonal line between any two opposing corners. |
| vPerimeter | Perimeter around the outside of the square. |
| vSide | Length of the side of the square. |
Notes & Version History
| Summary | One of the arguments should contain a numeric value--the given value for that property. 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 none of the arguments can be fixed up to a real or complex number (as defined by the IsComplex function). Otherwise, the function returns the value of the property whose argument was passed the word "CALC". |
| 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. |