Jump to content
Fórum Script Brasil
  • 0

Arredondar Números Fracionarios


Joaozava

Question

5 answers to this question

Recommended Posts

  • 0

Não lembro de alguma que arredonda para cima, então fiz a minha, acho que dá certo.

Private Function Arredonda(Numero As Double) As Integer
Dim Contador As Integer
    
    If InStr(1, Numero, ".") <> 0 Then
        For Contador = InStr(1, Numero, ".") To Len(Numero)
            If Mid(Numero, Contador, Contador) <> 0 Then
                Numero = Numero + 1
                Exit For
            End If
        Next
        Arredonda = Mid(Numero, 1, InStr(1, Numero, "."))
    Else
        Arredonda = Numero
    End If
    
End Function

wink.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      651.8k
×
×
  • Create New...