Share via


WorksheetFunction.Dollar Method

The function described in this Help topic converts a number to text format and applies a currency symbol. The name of the function (and the symbol that it applies) depends upon your language settings.

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

Syntax

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

returnValue = instance.Dollar(Arg1, Arg2)
string Dollar(
    double Arg1,
    Object Arg2
)

Parameters

  • Arg1
    Type: System.Double

    Number - a number, a reference to a cell containing a number, or a formula that evaluates to a number.

  • Arg2
    Type: System.Object

    Decimals - the number of digits to the right of the decimal point. If decimals is negative, number is rounded to the left of the decimal point. If you omit decimals, it is assumed to be 2.

Return Value

Type: System.String

Remarks

The major difference between formatting a cell that contains a number with the Cells command (Format menu) and formatting a number directly with the Dollar function is that Dollar converts its result to text. A number formatted with the Cells command is still a number. You can continue to use numbers formatted with Dollar in formulas, because Microsoft Excel converts numbers entered as text values to numbers when it calculates.

See Also

Reference

WorksheetFunction Interface

WorksheetFunction Members

Microsoft.Office.Interop.Excel Namespace