Not sure why assigning cell data with .value unexpectedly rounds number

jardenp

Active Member
Joined
May 12, 2009
Messages
373
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2011
  5. 2010
Platform
  1. Windows
Here's the line
VBA Code:
ImportWS.Cells(ImportAddRow, ImpRate) = SourceWS.Cells(r, MilR).Value

SourceWS.Cells(r,MilR) actual value is $.445 formatted as currency. The value that gets written into ImportWS.Cells(ImportAddRow, ImpRate) is $.45. Why does this round to 2 decimal places?

When I MsgBox SourceWS.Cells(r, MilR).Value is shows $.445, not the rounded number.

I adjusted the code to
VBA Code:
ImportWS.Cells(ImportAddRow, ImpRate) = SourceWS.Cells(r, MilR)
and it works, so this question is more for educational purposes.

Thanks in advance!

Josh
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
AFAIK what you're seeing is the standard currency rounded to 2 places, but removing the .Value stores not only the value but the larger decimal places currency format from the SourceWS.Cells(r, MilR).
 
Upvote 0
AFAIK what you're seeing is the standard currency rounded to 2 places, but removing the .Value stores not only the value but the larger decimal places currency format from the SourceWS.Cells(r, MilR).
Thanks for the reply. That's what I thought.
 
Upvote 0
Thanks for updating us! :) Glad to help
 
Upvote 0

Forum statistics

Threads
1,217,044
Messages
6,134,227
Members
449,862
Latest member
Muhamad Irfandi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top