Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 23rd, 2008, 05:52 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default help required to change format when converted from

Hi Guys,

I am Using Microsoft office Excel 2003.

I am saving an excel file as xmlspreadsheet.

When I do this the values in column L of the excel spreadsheet is displayed in the xml spreadsheet in exponential form.

eg: 2.8525% in excel sheet is displayed in xml as

2.8524999999999998E-2



Could anyone please assist me in rectifying this: I need the value in the xml to be displaying in %age form.

e.g: 2.8524999999999998E-2 in xml should actually be displayed as 2.8525%.

style defined for this particular value in the xml as below.

<Style ss:ID="s109" ssarent="s24">

<Alignment ss:Horizontal="Right" ss:Vertical="Bottom"/>

<Borders/>



<Interior ss:Color="#FFFFFF" ssattern="Solid"/>

<NumberFormat ss:Format="0.0000000000%"/>

</Style>



Please help me to resolve this issue.

Looking forward for a quick response.



rgds

NithinJ


 
Old September 23rd, 2008, 07:45 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi Nithin

I think you are using Workbook.SaveAs to save the file as XML. In that case you have little control of the format.

Excel takes the CEllFormat and applies the same in XML

1). If cell has percentage format it will be saved as a number and the format will be part of the style

2). Though you have 2.8525% on your Excel range, the actual data would be 2.8524999999999998E-2

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old September 25th, 2008, 01:01 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Shasur,
 Thanks for your reply.
  Basically I am using Workbook.SaveAs to save the file as XML.But the problem also persists if I save the excelspreadsheet as xmlspreadsheet by using the option in the excelsheet(FILE -> SAVEAS
-> XMLSPREADSHEET ).I am totally baffled why the excel is behaving like this.I have also placed the style defined in the xml for that value.

Kindly give me some ideas on this...

Regards,
TD






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help required for data entry format Creatoronline SQL Server 2000 1 May 27th, 2008 01:58 PM
CHANGE DATE FORMAT Vision G Access VBA 2 April 8th, 2008 12:16 PM
Transforming data in required XML Format pvasudevan XSLT 6 September 6th, 2006 02:34 AM
how to change date format prasannagps Forum and Wrox.com Feedback 2 September 14th, 2005 01:28 PM
date format change yuvalk SQL Server DTS 2 March 29th, 2004 05:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.