Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-12-2019, 01:59 PM
anne.kiss@ntlworld.com anne.kiss@ntlworld.com is offline excel macro returning the wrong value Windows 10 excel macro returning the wrong value Office 2013
Novice
excel macro returning the wrong value
 
Join Date: Mar 2019
Posts: 2
anne.kiss@ntlworld.com is on a distinguished road
Default excel macro returning the wrong value

Hi Folks

Not sure if this has already been posted.

I have set up two variables as double in an excel macro and populated them with two values from cells in the workbook. Using Msgbox I print out the variables and get the expected values of 14.1 and 14.1. I use a further Msgbox to print out the difference between the two variables (variable 1 - variable 2) and I get -1.77635683940025E-15

I was expecting this to be zero.

I have tried recreating the excel file and making sure that the cells are all formatted as numbers with 1 decimal place.

I have tried setting the variables to zero immediately before inserting the values.



This is in a loop and other values are correct.

What am I doing wrong?
Reply With Quote
 

Tags
cell value, excel macro

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel macro returning the wrong value Table column width wrong - unless macro paused!? Kebap Word VBA 7 09-21-2018 03:14 PM
Returning text, date, time, location from one Excel sheet to another dave57 Excel 17 06-15-2017 10:45 AM
excel macro returning the wrong value Excel colums are wrong way around SteveL Excel 1 05-06-2015 02:09 AM
excel macro returning the wrong value Macro operates on wrong document window marceepoo Word VBA 1 12-20-2012 03:12 PM
need macro for quiz (?) repeat of wrong answers with shuffle braveshark PowerPoint 0 10-02-2012 06:10 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft