+ Reply to Thread
Results 1 to 3 of 3

Prevent macro from rounding off when adding

  1. #1
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Manila philippines
    MS-Off Ver
    Excel 2010
    Posts
    113

    Prevent macro from rounding off when adding

    I have file with macro (I did not code this as I am not yet very familiar with macro) that replicate the details of specific line (Service sheet) based on the number of marks indicated in column F. The output will generated in Output sheet. In column E (Output sheet), the amount will be reflected based on the value indicated on column G (Servicesheet). on the succeeding line on column E, it will add the additional value + the value from column h (service sheet). The macro is working correctly. However, if the value of columns G and H (service sheet) have decimal points, the value in column e (output e) is automatically rounded off by macro. Resulting to incorrect value.

    example in Output sheet

    E2 is 94 while it should be 94.50
    E3 is 188 while it should be 189 (94.50 + 94.50)
    E4 is 282 while it should be 283.50

    I hope explain my problem clearly.
    Attached Files Attached Files
    Last edited by bambino86; 01-26-2022 at 10:10 PM.

  2. #2
    Forum Expert
    Join Date
    08-17-2007
    Location
    Poland
    Posts
    2,251

    Re: Prevent macro from rounding off when adding

    Change the variable declaration to:
    Please Login or Register  to view this content.
    Artik

  3. #3
    Forum Contributor
    Join Date
    05-13-2009
    Location
    Manila philippines
    MS-Off Ver
    Excel 2010
    Posts
    113

    Re: Prevent macro from rounding off when adding

    Quote Originally Posted by Artik View Post
    Change the variable declaration to:
    Please Login or Register  to view this content.
    Artik
    Thank you! It works perfectly!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Adding the hours by rounding to 15 minutes.
    By preciouslife73 in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 08-07-2016, 08:56 AM
  2. Replies: 2
    Last Post: 07-30-2010, 10:02 PM
  3. RE: Time Rounding Up and Adding
    By Jako in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2006, 09:49 PM
  4. Macro to prevent adding sheet in a workbook.
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-14-2006, 10:55 PM
  5. prevent rounding up
    By jhahes in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-23-2006, 03:40 PM
  6. how to prevent numbers in spread sheet from rounding
    By BSA in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 10-19-2005, 02:05 PM
  7. Code to Prevent Adding Worksheets
    By Paige in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2005, 06:06 PM

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