ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Replacing DirectPrecedents in a Formula (https://www.excelbanter.com/excel-programming/282931-replacing-directprecedents-formula.html)

Gappodi

Replacing DirectPrecedents in a Formula
 
Hello,

I need to copy a formula to a different sheet where the
DirectPrecedents positions are different. I can get the
DirectPrecedents from the source using the DirectPrecedents property.
I have the corresponding mapping of these DirectPrecedents in the
target.

Is there a way using the Excel Model to replace these DirectPrecedents
using the mapping I have or I have to parse the source and modify the
target accordingly.

Thanks and Regds
Gap

Chip Pearson

Replacing DirectPrecedents in a Formula
 
Gap,

I'm not sure exactly what your question is. DirectPrecendents is a
read-only property, and any change in the would need to be done by changing
the cell references used in the formula. Depending on your specific
situation, you *might* be able to use the INDIRECT function to accomplish
what you want, but without more information, it is impossible to say.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Gappodi" wrote in message
om...
Hello,

I need to copy a formula to a different sheet where the
DirectPrecedents positions are different. I can get the
DirectPrecedents from the source using the DirectPrecedents property.
I have the corresponding mapping of these DirectPrecedents in the
target.

Is there a way using the Excel Model to replace these DirectPrecedents
using the mapping I have or I have to parse the source and modify the
target accordingly.

Thanks and Regds
Gap




Gap Podi

Replacing DirectPrecedents in a Formula
 

Chip,

If my formula is "=SUM(A1:A5)" I need to replace this with say
"=SUM(A11:A15)". I have the mapping available with me in this case A1 -
A11 and A5 - A15.

I was looking for nice way of doing this without having to parse the
formula and replace the references based on the mapping.

Thanks for your reply

Regds
Gap.


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT +1. The time now is 07:19 AM.

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