R
robert.hatcher
I'm not sure if this a Worksheet Function issue or a VBA issue
because it involves both...
I need to paste a named formula, using VBA into a vertical range of
cells. I need the formula to add the value of the previous cell (the
cell above the current cell) the result of a separate calculation in
the formula.
The VBA code is working and pasts the formula where I need it.
The "separate calculation" is working
In troubleshooting my problem I found:
If I write the formula directly into the first cell and then copy and
paste it manually into the rest of the range everything works fine.
Formula as written in A114 and also in the "Refers To:" block for
Name "BinSizeForm2"
=A113+INDIRECT($C$114&"BinSize"&$D$114)
As pasted in subsequent cells:
=A114+INDIRECT($C$114&"BinSize"&$D$114)
=A115+INDIRECT($C$114&"BinSize"&$D$114)
=A116+INDIRECT($C$114&"BinSize"&$D$114)
And so on... which works perfect
Putting "=BinSizeForm2" in each cell returns the correct results
also.
The problem occurs when the name is written to the range cells using
VBA; all cells end up with the same value (formula):
=Htestc!A113+INDIRECT(Htestc!$C$114&"BinSize"&Htes tc!$D$114)
Every cell starts with A113 instead of the previous cell reference.
Help.
because it involves both...
I need to paste a named formula, using VBA into a vertical range of
cells. I need the formula to add the value of the previous cell (the
cell above the current cell) the result of a separate calculation in
the formula.
The VBA code is working and pasts the formula where I need it.
The "separate calculation" is working
In troubleshooting my problem I found:
If I write the formula directly into the first cell and then copy and
paste it manually into the rest of the range everything works fine.
Formula as written in A114 and also in the "Refers To:" block for
Name "BinSizeForm2"
=A113+INDIRECT($C$114&"BinSize"&$D$114)
As pasted in subsequent cells:
=A114+INDIRECT($C$114&"BinSize"&$D$114)
=A115+INDIRECT($C$114&"BinSize"&$D$114)
=A116+INDIRECT($C$114&"BinSize"&$D$114)
And so on... which works perfect
Putting "=BinSizeForm2" in each cell returns the correct results
also.
The problem occurs when the name is written to the range cells using
VBA; all cells end up with the same value (formula):
=Htestc!A113+INDIRECT(Htestc!$C$114&"BinSize"&Htes tc!$D$114)
Every cell starts with A113 instead of the previous cell reference.
Help.