Problem with writing Value from one file to another

frank_AL

Active Member
Joined
Oct 30, 2015
Messages
444
I have a company/product cost file and need to carry specific data from that file over to a monthly customer file that lists all the products the customer purchases in a given month. One of the fields is the cost of the product. In the cost file, that field is formatted as 'Number'. There are many records in that file where the cost will extend up to 4 decimal places (e.g., 1.5364) and it is imperative that these values by accurately written to the monthly customer file.

One of the records in the cost file shows a cost of 5.677. The problem I am having is that when that particular value is written in the monthly customer file I get 5.67. There are several records in the monthly customer file that is a match and every one of them is showing up with 5.67. I did change the number of decimal places to 4 so it is not simply an issue of not showing all #s via a formatting issue. Besides if that was the issue it would be showing up as 5.68. :)

This is the line of code I am using to write the Value from one file to another:
VBA Code:
custWS.Cells(i, "L").Value = ccWS.Cells(x, "K").Value

I have been researching online and I tried using Value2 but still get the same result.
I tried to first change the format of the Column to Currency but still get the same result.

Any and all help would be much appreciated!

Thanks,

Frank
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

johnnyL

Well-known Member
Joined
Nov 7, 2011
Messages
796
Office Version
  1. 2013
  2. 2007
Platform
  1. Windows
? Same with:

VBA Code:
custWS.Range("L" & i).Copy ccWS.Range("K" & x)
 

frank_AL

Active Member
Joined
Oct 30, 2015
Messages
444
? Same with:

VBA Code:
custWS.Range("L" & i).Copy ccWS.Range("K" & x)
Johnny I tried your code & I don’t know why but I had even more unpredictable results. Ultimately I determined there were 2 records in the original file that were duplicates based on match criteria; one with 5.677 & 1 with 5.670.

I am working with the owner if that file to get this corrected.

Thank you for responding!
Frank
 
Solution

Forum statistics

Threads
1,136,633
Messages
5,676,896
Members
419,657
Latest member
ExcelAl1

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
Top