Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default rounding of numbers in vba

I have written a program the logs thermal data from a PLC
to a separate excel sheet. The PLC logs the data as a
three place whole number (i.e. 639 = 63.9°F), so I
modified the code to reflect the conversion to a 2 place
decimal(i.e. Tag1 / 10) and formatted the columns to
reflect the same. The problem I have is that when it
throws the data into the sheet, it is rounding the
numbers (i.e 639 =64.00°F). Is there a way that I can
reset this to show the actual (63.9)?


Thanks in advance,

John Petty

P.S. I am using Excel 2002 (XP)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default rounding of numbers in vba

Are you sure your variable that holds the data isn't dimmed as long or
integer. Make sure it is double or single.

--
Regards,
Tom Ogilvy

"john petty" wrote in message
...
I have written a program the logs thermal data from a PLC
to a separate excel sheet. The PLC logs the data as a
three place whole number (i.e. 639 = 63.9°F), so I
modified the code to reflect the conversion to a 2 place
decimal(i.e. Tag1 / 10) and formatted the columns to
reflect the same. The problem I have is that when it
throws the data into the sheet, it is rounding the
numbers (i.e 639 =64.00°F). Is there a way that I can
reset this to show the actual (63.9)?


Thanks in advance,

John Petty

P.S. I am using Excel 2002 (XP)


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default rounding of numbers in vba

Are you saving the values in an integer variable before
you put them in the cell? That could be the culprit.
Also are you rounding before you put the values in the
cell in VBA? Try reformating the whole sheet back to
general and then start the formatting over. Hope that
helps.

Keith
www.kjtfs.com
-----Original Message-----
I have written a program the logs thermal data from a

PLC
to a separate excel sheet. The PLC logs the data as a
three place whole number (i.e. 639 = 63.9°F), so I
modified the code to reflect the conversion to a 2 place
decimal(i.e. Tag1 / 10) and formatted the columns to
reflect the same. The problem I have is that when it
throws the data into the sheet, it is rounding the
numbers (i.e 639 =64.00°F). Is there a way that I can
reset this to show the actual (63.9)?


Thanks in advance,

John Petty

P.S. I am using Excel 2002 (XP)
.

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
Rounding Numbers. GEM Excel Worksheet Functions 2 August 1st 08 08:15 AM
rounding numbers Peter lansberg Excel Worksheet Functions 3 August 28th 06 01:17 PM
Rounding Numbers trimatt Excel Discussion (Misc queries) 2 August 8th 05 03:47 PM
Rounding Numbers jack aubrey Excel Discussion (Misc queries) 1 April 18th 05 07:10 PM
Rounding numbers then doing a sum of those numbers produces incorrect result. GzusRox Excel Programming 2 July 26th 03 01:42 PM


All times are GMT +1. The time now is 02:29 PM.

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

About Us

"It's about Microsoft Excel"