Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to convert data

Hi,
On sheet named AREA has the follow data

A B C
ASD 22 3 4
BSD 6 7 8
CSD 9 11 8
EFD 16 19 8
GFD 27 27 8

Need to convert the data to the below format and then saved as xml
file. Any help with code or direction to where i could get this would be
greatly appreciated.
Can the code be created to convert a specific range of cells?


<data
<variable name="AREA"
<row
<column</column
<columnA</column
<columnB</column
<columnC</column
</row
<row
<columnASD</column
<column122</column
<column3</column
<column4</column
</row
<row
<columnBSD</column
<column116</column
<column7</column
<column8</column
</row
<row
<columnCSD</column
<column119</column
<column11</column
<column8</column
</row
<row
<columnEFD</column
<column16</column
<column19</column
<column8</column
</row
<row
<columnGFD</column
<column27</column
<column27</column
<column8</column
</row
</variable
</data


Regards,
Sujith
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Macro to convert data

Excel 2003 does it automatically
DAtaXMLExport

"Sujith" wrote:

Hi,
On sheet named AREA has the follow data

A B C
ASD 22 3 4
BSD 6 7 8
CSD 9 11 8
EFD 16 19 8
GFD 27 27 8

Need to convert the data to the below format and then saved as xml
file. Any help with code or direction to where i could get this would be
greatly appreciated.
Can the code be created to convert a specific range of cells?


<data
<variable name="AREA"
<row
<column</column
<columnA</column
<columnB</column
<columnC</column
</row
<row
<columnASD</column
<column122</column
<column3</column
<column4</column
</row
<row
<columnBSD</column
<column116</column
<column7</column
<column8</column
</row
<row
<columnCSD</column
<column119</column
<column11</column
<column8</column
</row
<row
<columnEFD</column
<column16</column
<column19</column
<column8</column
</row
<row
<columnGFD</column
<column27</column
<column27</column
<column8</column
</row
</variable
</data


Regards,
Sujith

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to convert data

Vacation's Over wrote:
Excel 2003 does it automatically
DAtaXMLExport

"Sujith" wrote:


Hi,
On sheet named AREA has the follow data

A B C
ASD 22 3 4
BSD 6 7 8
CSD 9 11 8
EFD 16 19 8
GFD 27 27 8

Need to convert the data to the below format and then saved as xml
file. Any help with code or direction to where i could get this would be
greatly appreciated.
Can the code be created to convert a specific range of cells?


<data
<variable name="AREA"
<row
<column</column
<columnA</column
<columnB</column
<columnC</column
</row
<row
<columnASD</column
<column122</column
<column3</column
<column4</column
</row
<row
<columnBSD</column
<column116</column
<column7</column
<column8</column
</row
<row
<columnCSD</column
<column119</column
<column11</column
<column8</column
</row
<row
<columnEFD</column
<column16</column
<column19</column
<column8</column
</row
<row
<columnGFD</column
<column27</column
<column27</column
<column8</column
</row
</variable
</data


Regards,
Sujith

Thanks, but i am using excel 2002. Can this be achieved in 2002 to get
the above. I tried saving the sheet as xml spreadsheet but did not give
me the above structure, which is critical.
R/,
Sujith
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,588
Default Macro to convert data

Just open a file from vba and write out the XML by looping through the
range.

eg (untested - treat as pseudocode)

dim rngOut as range,r as row, c as range

set rngOut=activesheet.range("A1:C10") 'for example

'....open file write the header info to file

'loop through content
for each r in rngOut.rows
'print to file "<row"
for each c in r.cells
'print to file "<column" & c.value & "</column"
next
'print to file "</row"
next r


Tim


"Sujith" wrote in message
...
Vacation's Over wrote:
Excel 2003 does it automatically
DAtaXMLExport

"Sujith" wrote:


Hi,
On sheet named AREA has the follow data

A B C
ASD 22 3 4
BSD 6 7 8
CSD 9 11 8
EFD 16 19 8
GFD 27 27 8

Need to convert the data to the below format and then saved as
xml file. Any help with code or direction to where i could get
this would be greatly appreciated.
Can the code be created to convert a specific range of cells?


<data
<variable name="AREA"
<row
<column</column
<columnA</column
<columnB</column
<columnC</column
</row
<row
<columnASD</column
<column122</column
<column3</column
<column4</column
</row
<row
<columnBSD</column
<column116</column
<column7</column
<column8</column
</row
<row
<columnCSD</column
<column119</column
<column11</column
<column8</column
</row
<row
<columnEFD</column
<column16</column
<column19</column
<column8</column
</row
<row
<columnGFD</column
<column27</column
<column27</column
<column8</column
</row
</variable
</data


Regards,
Sujith

Thanks, but i am using excel 2002. Can this be achieved in 2002 to
get the above. I tried saving the sheet as xml spreadsheet but did
not give me the above structure, which is critical.
R/,
Sujith



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Macro to convert data

Tim Williams wrote:
Just open a file from vba and write out the XML by looping through the
range.

eg (untested - treat as pseudocode)

dim rngOut as range,r as row, c as range

set rngOut=activesheet.range("A1:C10") 'for example

'....open file write the header info to file

'loop through content
for each r in rngOut.rows
'print to file "<row"
for each c in r.cells
'print to file "<column" & c.value & "</column"
next
'print to file "</row"
next r


Tim

thx will try it out
Sujith
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
macro to convert excel to PDF EricBB Excel Discussion (Misc queries) 2 March 18th 09 04:03 PM
I want to convert word column data to excel row data to sort addre craywill Excel Discussion (Misc queries) 0 April 18th 06 07:16 PM
Convert hhhh:mm:ss to hh:mm:ss (macro ?) BT Bill Excel Worksheet Functions 1 March 8th 05 08:50 AM
can i convert data copied as an image into data in excel ? prabhat Excel Worksheet Functions 1 March 1st 05 12:49 PM
Using Macro to convert 240 to PRN Kenneth Excel Programming 1 November 9th 03 11:43 PM


All times are GMT +1. The time now is 05:57 AM.

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"