Problem with writing Value from one file to another

frank_AL

Active Member
Joined
Oct 30, 2015
Messages
467
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

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
? Same with:

VBA Code:
custWS.Range("L" & i).Copy ccWS.Range("K" & x)
 
Upvote 0
? 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
 
Upvote 0
Solution

Forum statistics

Threads
1,214,638
Messages
6,120,674
Members
448,977
Latest member
moonlight6

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