WorksheetFunction.Fixed Method

Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function Fixed ( _
    Arg1 As Double, _
    Arg2 As Object, _
    Arg3 As Object _
) As String
'Usage
Dim instance As WorksheetFunction
Dim Arg1 As Double
Dim Arg2 As Object
Dim Arg3 As Object
Dim returnValue As String

returnValue = instance.Fixed(Arg1, Arg2, _
    Arg3)
string Fixed(
    double Arg1,
    Object Arg2,
    Object Arg3
)

Parameters

  • Arg1
    Type: System.Double

    Number - the number you want to round and convert to text.

  • Arg2
    Type: System.Object

    Decimals - the number of digits to the right of the decimal point.

  • Arg3
    Type: System.Object

    No_commas - a logical value that, if true, prevents Fixed from including commas in the returned text.

Return Value

Type: System.String

Remarks

Numbers in Microsoft Excel can never have more than 15 significant digits, but decimals can be as large as 127.

If decimals is negative, number is rounded to the left of the decimal point.

If you omit decimals, it is assumed to be 2.

If no_commas is false or omitted, then the returned text includes commas as usual.

The major difference between formatting a cell containing a number with the Cells command (Format menu) and formatting a number directly with the FIXED function is that Fixed converts its result to text. A number formatted with the Cells command is still a number.

See Also

Reference

WorksheetFunction Interface

WorksheetFunction Members

Microsoft.Office.Interop.Excel Namespace