Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default importing large numbers to vb results in the numbers being formatted to scientific

HI,

I am trying to stop large numbers such as
0.0977376573888888 being read into vb as

9.77376573888888E-02 when I import using the following

strRate=xlApp.Worksheets(intSheetNo).Range(strRate Col & intI).Value

I wish to read that number and format it to 4 decimal places
as follows

..0977.
However, it is already read in in scientific notation so I cannot
format it then. Does anyone know how to solve this?

Thanks

Molly


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default importing large numbers to vb results in the numbers being formatted to scientific

Molly,

Simply format it in the same step as when you read it:

Dim strRate As String
strRate = Format(xlApp.Worksheets(intSheetNo) _
..Range(strRateCol & intI).Value, "0.0000")
MsgBox strRate

This will give 0.0977, which is what I assumed you wanted when you
meant 4 decimal places.

If you really want 0977. then you will need to use:

strRate = Format(10000 * Worksheets(1) _
..Range("A" & 1).Value, "0000.")

HTH,
Bernie
MS Excel MVP

"molly " wrote in message
...
HI,

I am trying to stop large numbers such as
0.0977376573888888 being read into vb as

9.77376573888888E-02 when I import using the following

strRate=xlApp.Worksheets(intSheetNo).Range(strRate Col & intI).Value

I wish to read that number and format it to 4 decimal places
as follows

0977.
However, it is already read in in scientific notation so I cannot
format it then. Does anyone know how to solve this?

Thanks

Molly


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default importing large numbers to vb results in the numbers being formatted to scientific

thanks for you help... I was all set to write a ridulous function to
find E etc..


---
Message posted from http://www.ExcelForum.com/

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
large numbers as text replaced with scientific notation [email protected] Excel Discussion (Misc queries) 2 January 12th 09 11:33 PM
IMPORTING DATA MY NUMBERS ARE NOT READ AS NUMBERS BRAINOC Excel Worksheet Functions 2 July 9th 08 01:24 AM
Hex numbers displayed in scientific notation when importing text f Gabriel Nehmer Excel Discussion (Misc queries) 2 July 20th 07 04:08 PM
Supress Scientific Numbers?? Sam New Users to Excel 2 August 11th 05 08:40 PM
Converting numbers formatted as text to numbers Bill Excel Discussion (Misc queries) 1 July 19th 05 07:10 PM


All times are GMT +1. The time now is 11:31 PM.

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"