+ Reply to Thread
Results 1 to 6 of 6

Rounding error when copying value from one sheet to another

  1. #1
    Registered User
    Join Date
    04-03-2006
    Posts
    31

    Rounding error when copying value from one sheet to another

    Hello: I am not a VBA programmer but I have gathered enough info to accomplish most of what I set out to, Much thanks to this forum. I am still having an issue with one item. When I try to copy a value from one worksheet to another it is rounding off the number to 2 decimal places rather than 4. eg shows up on sheet 3 as $13.4100 rather than $13.4135.
    Both cells are formatted to display currency to 4 decimal places.
    The value being copied from sheet one is calculated using a formula
    =IF(F31>0,M31/L31,IF(AND(G31>0,E31>0),K30,IF(AND(G31>0,E31=0),M31/L31,"")))

    and the code used to transfer the info is:
    Please Login or Register  to view this content.
    Sheets("Sheet3").Cells(nextrow, "E").Value = Range(Cells(i, "K"), Cells(i, "K")).Value 'ACB/Share
    This is the line giving me issues.

    On sheet 1 the value is displayed to 4 decimal points but on sheet 3 there are 4 decimal places but the last two are both zero's
    Any Ideas on why this is happening
    Last edited by xned; 02-28-2010 at 01:51 AM.

  2. #2
    Registered User
    Join Date
    04-03-2006
    Posts
    31

    Re: Rounding error when copying value from one sheet to another

    I have included a copy of the spreadsheet in case it helps. There is a button at the top of sheet one called "REPORTS" and the issue is with the tax report button on the form. Specifically the ACB / Share, column E on worksheet 3.
    Attached Files Attached Files

  3. #3
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Rounding error when copying value from one sheet to another

    Holy cow! A Zip file with almost one MB?!

    Could you possibly boil it down to something more manageable? I shudder at the amount of data I'll have to wade through to get to the core of the issue. I'm sure you will be able to re-create the behaviour in a workbook of max 50Kb.

    I don't have an unlimited data plan, and I suspect most here don't either.

  4. #4
    Registered User
    Join Date
    04-03-2006
    Posts
    31

    Re: Rounding error when copying value from one sheet to another

    Will try to strip it down. This has quite a few macro's and formulas in it is why it is so large.

  5. #5
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Rounding error when copying value from one sheet to another

    Macros and formulas won't blow a file up to a size that its Zip version is 1 MB. Strip down the data. A couple of dozen lines should be sufficient!

  6. #6
    Registered User
    Join Date
    04-03-2006
    Posts
    31

    Re: Rounding error when copying value from one sheet to another

    Here is the slimmed down version. Only 7 lines of data.
    As I mentioned above, The trouble I am having is with the "Reports" Button which opens a userform.
    This userform contains 2 buttons for preparing different reports.
    I am having trouble with both reports rounding off one of the numbers being copied from worksheet 1 to worksheet 3.
    If you type in 2005 and select either the "annual" or "Tax Report" buttons, the ACB / Share value is rounded off to 2 decimal places.
    Attached Files Attached Files
    Last edited by xned; 02-28-2010 at 04:01 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1