Sorry for not being able to explain correctly in the thread topic. I'll try my best to detail down the problem below.

Now what I would like the VBA code to do is to paste the ultimate precedent value instead of directly pasting the answer.

Consider cells in the below table (A1 as 10, A2 as 20, etc)

Now Cells A4, B4, and D4 are basically cells that sum the first 3 cells of that column. For instance, the formula in Cell A4 is

Let's say, I have a function in Cell E4, which contains the formula

Now if I keep E4 as an active cell, the function should return the output as

Not as
, and not even as
(i.e. the values of Cell A4, B4, and D4)

The above example was pretty straight forward to do since it only contains a simple sum formula.

However let's say if I have certain other formulas wherein there are Index Matchs or Offsets, it would be complicated. Also in the above formula, there were just two layers, i.e. from E4 to A4 ... and from A4 to A1.... etc. Now there could also be more layers. e.g. Instead of A1 being a plain value it could be a sum of X1 and Y1. So, the most core value of any range should be pasted.

Thus I would like the ranges in a specific formula of the cell to be broken down as their most primitive values, and retain other functions as it is. You could see something like this if you use the Evaluate Formula option from the "Formula Auditing" tool of Excel

I just wanted to check if something like this was possible to do using some VBA feature I was unaware of? I'm not even asking for you to write code, I'll try to write it by myself. I just need someone to point me in the right direction.

Please feel free to reply if you do not understand my problem.

Now what I would like the VBA code to do is to paste the ultimate precedent value instead of directly pasting the answer.

Consider cells in the below table (A1 as 10, A2 as 20, etc)

A | B | D |

10 | 40 | 70 |

20 | 50 | 80 |

30 | 60 | 90 |

Now Cells A4, B4, and D4 are basically cells that sum the first 3 cells of that column. For instance, the formula in Cell A4 is

Excel Formula:

`SUM(A1:A3)`

Let's say, I have a function in Cell E4, which contains the formula

Excel Formula:

`SUM(A4, B4, D4)`

Now if I keep E4 as an active cell, the function should return the output as

Code:

`(10+20+30)+(40+50+60)+(70+80+90)`

*The brackets are not mandatory*Not as

Excel Formula:

`5500`

Excel Formula:

`60 + 150 + 240`

The above example was pretty straight forward to do since it only contains a simple sum formula.

However let's say if I have certain other formulas wherein there are Index Matchs or Offsets, it would be complicated. Also in the above formula, there were just two layers, i.e. from E4 to A4 ... and from A4 to A1.... etc. Now there could also be more layers. e.g. Instead of A1 being a plain value it could be a sum of X1 and Y1. So, the most core value of any range should be pasted.

Thus I would like the ranges in a specific formula of the cell to be broken down as their most primitive values, and retain other functions as it is. You could see something like this if you use the Evaluate Formula option from the "Formula Auditing" tool of Excel

I just wanted to check if something like this was possible to do using some VBA feature I was unaware of? I'm not even asking for you to write code, I'll try to write it by myself. I just need someone to point me in the right direction.

Please feel free to reply if you do not understand my problem.

Last edited: