How to hold currency without rounded in VBA

Hello experts,

I made a report in VBA where I need to hold money but the result always is rounded, for example:
If the source data is 528.85 , the report shows 529.

Could you please help me in this matter?
Dim cAcumulaCheques As String
Dim cAcumulaMonto As String
Dim nMonto As Integer
Dim nMontoCurrency As Currency
Dim nSumaTotalMonto As Currency

    For I = 3 To wsSource.Cells(Rows.Count, "A").End(xlUp).Row
        If wsSource.Cells(I, 4).Value = "" Then
            GoTo Nexts
            If Val(wsSource.Cells(I, 1)) = Val(nDia) And Val(wsSource.Cells(I, 2)) = Val(nMes) And Val(wsSource.Cells(I, 3)) = Val(nAno) Then
                If Trim(wsSource.Cells(I, 15) <> "") Then
                    cAcumulaCheques = Trim(wsSource.Cells(I, 15))
                    nMonto = CInt(wsSource.Cells(I, 16))
                    nMontoCurrency = Format(nMonto, "Currency")
                    cAcumulaMonto = nMontoCurrency
                    nSumaTotalMonto = (nSumaTotalMonto + nMonto)
                End If

Open in new window

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

Gustav BrockConnect With a Mentor CIOCommented:
Please, how do you imagine that to happen when you have declared nMonto as Integer?

Even if you change it to Currency, you round the values to integers with CInt.

So the rounding doesn't "just happen", you specifically twice have coded it so.

Gustav BrockCIOCommented:
You are positively rounding your values to integers:

nMonto = CInt(wsSource.Cells(I, 16))
nMontoCurrency = Format(nMonto, "Currency")

so that's why.

elm9999Author Commented:
But doesn't work

the nMontoCurrency must have 68.76 but displays 69
elm9999Author Commented:
Thank you Gustav,

You right, I alredy fix it.
All Courses

From novice to tech pro — start learning today.