Share via

VBA Function returns wrong value

Anonymous
2023-06-12T08:31:27+00:00

Hi,

My number is

2,495,159,565.00

in VBA I am converting it with the function Fix or Int. It returns as

2,495,159,564

Please see the video...

Sample Video

Microsoft 365 and Office | Excel | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2023-06-12T09:16:13+00:00

Hi Umut

Please, make sure that the variables iVal and num_entry are correctly Dimentioned

i.e.

Dim iVal As Double

Dim num_entry as Double

OR

Dim iVal As LongLong

Dim num_entry as Double

Image

Image

For more info please, check the links below

https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/double-data-type https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/longlong-data-type

Regards

Jeovany

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2023-06-12T11:16:24+00:00

    Hi Jeovany,

    Thank you for the fast reply.

    Actually, I had the Dimentioned without "as Double" part. Then, I tried "num_entry as Integer", it didnt work and then I tried "as Double" and worked like a charm.

    Option Explicit

    Dim iVal As Double
    Dim num_entry As Double

    Was this answer helpful?

    0 comments No comments