ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Converting Excel Formula to Macro (https://www.excelbanter.com/excel-programming/311404-converting-excel-formula-macro.html)

mjm917

Converting Excel Formula to Macro
 

I hope this makes sense.

I am trying to reduce some manual intervention when creating an XM
file from Excel. Unfortunately I cannot just save the file in XM
format because many of the values are child values.

Current I copy a formula to a range of cells in a particular column
say column L, starting at row 5 and going to row n. The formula look
at values in other columns in the matching row concatenates the
together along with some hardcoded XML tags to create an XML string.

Example Data

Cell R5 = "Base Price"
Cell S5 = "" (Empty String)
Cell T5 = "22.50"
Cell U5 = "Online Price"
Cell V5 = "" (Empty String)
Cell W5 = "23.50"

I copy a formula to Cell L5 and the resulting value for L5 is:

<itemPriceLine
<itemPriceTypeRef
<nameBase Price</name
</itemPriceTypeRef
<itemPrice22.50</itemPrice
</itemPriceLine
<itemPriceLine
<itemPriceTypeRef
<nameOnline Price</name
</itemPriceTypeRef
<itemPrice23.50</itemPrice
</itemPriceLine

Any help wold be appreciate

--
mjm91
-----------------------------------------------------------------------
mjm917's Profile: http://www.excelforum.com/member.php...fo&userid=1471
View this thread: http://www.excelforum.com/showthread.php?threadid=26335


Bob Kilmer

Converting Excel Formula to Macro
 
What tasks are you trying to eliminate and how would describe to someone
unfamiliar with your process how to do them? Do you want to automate the
copying? What is the value of n? How is it determined? How do you decide
what column and row to copy the initial formula into?


"mjm917" wrote in message
...

I hope this makes sense.

I am trying to reduce some manual intervention when creating an XML
file from Excel. Unfortunately I cannot just save the file in XML
format because many of the values are child values.

Current I copy a formula to a range of cells in a particular column,
say column L, starting at row 5 and going to row n. The formula looks
at values in other columns in the matching row concatenates them
together along with some hardcoded XML tags to create an XML string.

Example Data

Cell R5 = "Base Price"
Cell S5 = "" (Empty String)
Cell T5 = "22.50"
Cell U5 = "Online Price"
Cell V5 = "" (Empty String)
Cell W5 = "23.50"

I copy a formula to Cell L5 and the resulting value for L5 is:

<itemPriceLine
<itemPriceTypeRef
<nameBase Price</name
</itemPriceTypeRef
<itemPrice22.50</itemPrice
</itemPriceLine
<itemPriceLine
<itemPriceTypeRef
<nameOnline Price</name
</itemPriceTypeRef
<itemPrice23.50</itemPrice
</itemPriceLine

Any help wold be appreciated


--
mjm917
------------------------------------------------------------------------
mjm917's Profile:

http://www.excelforum.com/member.php...o&userid=14711
View this thread: http://www.excelforum.com/showthread...hreadid=263354





All times are GMT +1. The time now is 05:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com