• Rounding number in VBA(2002/SP3)

    Author
    Topic
    #458092

    In my VBA code, I get an error for the following line with an error “Expected: =”

    If isnumberic(strABOL) Then round(strABOL,2)

    where, strABOL = rng.Offset(0, 1).Value

    What am I doing wrong?

    Viewing 0 reply threads
    Author
    Replies
    • #1150617

      In my VBA code, I get an error for the following line with an error “Expected: =”

      If isnumberic(strABOL) Then round(strABOL,2)

      where, strABOL = rng.Offset(0, 1).Value

      What am I doing wrong?

      Round is a function, so you must assign its return value to a variable:

      Dim dblVal As Double
      If IsNumeric(strABOL) Then dblVal = Round(strABOL, 2)

      (Please note that it is IsNumeric, not IsNumberic)

      • #1150758

        Round is a function, so you must assign its return value to a variable:

        Dim dblVal As Double
        If IsNumeric(strABOL) Then dblVal = Round(strABOL, 2)

        (Please note that it is IsNumeric, not IsNumberic)

        Great. Thanks Hans.

    Viewing 0 reply threads
    Reply To: Rounding number in VBA(2002/SP3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: