Jumat, 25 November 2011

[MS_AccessPros] Re: Copying values from Excel - rounding errors

 

Hi Bob,

I helps to add your name or nickname at the bottom
of your posts.

You are not doing anything wrong, but if you use
.Value you will not get all of the decimal places.

Try using .Value2 instead. That should increase the
number of decimal places. I tried it in Excel2003
and got,

?ActiveCell.Value
2.1429
?ActiveCell.Value2
2.14285714285714

Hope that fixes it.

Regards, Clive.

--- In MS_Access_Professionals@yahoogroups.com, "topfuelbob" <rvalder@...> wrote:
>
> In my Access 2007 application I use VBA to open two Excel workbooks and copy values between them.
>
> In the source sheet, the cells are formatted as currency with 2 decimal points, but the underlying values are obviously more than 2 dec places.
>
> However, in the destintion sheet, it is only copying the 'displayed' values, ie 2 dec places.
>
> The code I use is:
> xlDestSheet.Cells(intRow, strTrips).Value = xlSourceSheet.Cells(intRowCounter, 10).Value
> What am I doing wrong?
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar