Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Undesired Rounding in VBA; accumulating values

Sorry I don't have a copy of the source code handy, but here goes:

I'm reading values from a series of cells in one sheet (stored in a 2D
array), then accumulating values in a destination sheet. The array is
type Double; using XL2002.

The source data goes to three decimal places (ex. 0.245), but the
value accumulated is rounded (ex. 0.25).

Source Sheet reading:
ActiveCell.Offset(Row, Column).Value = dblArray(RV,CV)

Destination Sheet accumulating:
ActiveCell.Offset(Row, Column).Value =
ActiveCell.Offset(Row,Column).Value + dblArray(RV,CV)


-Glenn
Any clue as to why this is happening?
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Undesired Rounding in VBA; accumulating values

"Pecision as Displayed" is turned off. Format for both source and
destination cells is "$0.00" (Currency, "$", 2 digits).

I actually solved the problem last night by making the following
change in the accumulating formula:
Destination Sheet accumulating:
ActiveCell.Offset(Row, Column).Value = _
ActiveCell.Offset(Row,Column).Value2 + dblArray(RV,CV)

This corrected the rounding I was seeing, but I didn't expect the
error in the previous case in any regard.

Thanks,
Glenn


Ron Rosenfeld wrote in message . ..
On 24 Jan 2004 17:11:00 -0800, (Glenn Ray) wrote:

Sorry I don't have a copy of the source code handy, but here goes:

I'm reading values from a series of cells in one sheet (stored in a 2D
array), then accumulating values in a destination sheet. The array is
type Double; using XL2002.

The source data goes to three decimal places (ex. 0.245), but the
value accumulated is rounded (ex. 0.25).

Source Sheet reading:
ActiveCell.Offset(Row, Column).Value = dblArray(RV,CV)

Destination Sheet accumulating:
ActiveCell.Offset(Row, Column).Value =
ActiveCell.Offset(Row,Column).Value + dblArray(RV,CV)


-Glenn
Any clue as to why this is happening?


What is the format of ActiveCell.Offset(Row, Column)?
What is the setting of Options/Tools/Precision as displayed?


--ron

  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Undesired Rounding in VBA; accumulating values

On Sun, 25 Jan 2004 14:30:43 -0500, "Tom Ogilvy" wrote:

? ActiveCell.NumberFormat
$#,##0.00
? typename(activecell.Value)
Currency


Aha! That's why Value2 works differently than Value in this instance.

Thanks for the info.


--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
On exit from edit, Excel jumps to remote undesired cell. [email protected] Excel Discussion (Misc queries) 2 July 21st 08 12:15 PM
Undesired links: Pasting from one excel document to another ProS Links and Linking in Excel 1 December 30th 07 08:35 PM
Rounding up values Sarah (OGI) Excel Worksheet Functions 1 September 20th 07 11:17 AM
accumulating values generated daily Tracey Excel Worksheet Functions 1 April 15th 06 08:07 AM
Accumulating Values in a Pivot table Kurt Excel Discussion (Misc queries) 2 March 2nd 05 08:42 PM


All times are GMT +1. The time now is 09:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"