ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formulas (https://www.excelbanter.com/excel-programming/287843-formulas.html)

Max_Venezia

formulas
 
I wanted to repeat a formula contained into an initial cell in another
group of cells.
I selected the initial formula in this manner:

ActiveCell.select
x=Selection.formula

then I selected a group of cells
and I wanted to repeat the same formula contained in the initial cell
into these cells

I wrote:
SelectedRange.formula=x

In this way the furmulas I find in the new cells are not equal to the
initial one but
they change from cell to cell according to the position.
If I want to repeat exactly the initial formula in these new cells
regardless of the cell positions what kind of instruction I have to
use?

Thank you in advance.
Max

Bob Phillips[_6_]

formulas
 
Max,

You need to change the original formula to an absolute reference. For
example, if the formula is =A1+B1, change it to =$A$1+$B$1

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Max_Venezia" wrote in message
om...
I wanted to repeat a formula contained into an initial cell in another
group of cells.
I selected the initial formula in this manner:

ActiveCell.select
x=Selection.formula

then I selected a group of cells
and I wanted to repeat the same formula contained in the initial cell
into these cells

I wrote:
SelectedRange.formula=x

In this way the furmulas I find in the new cells are not equal to the
initial one but
they change from cell to cell according to the position.
If I want to repeat exactly the initial formula in these new cells
regardless of the cell positions what kind of instruction I have to
use?

Thank you in advance.
Max




Max_Venezia

formulas
 
The fact is that the original formula has not absolute reference and
it is correct. i want to transfer the same formula into another cell.
for example if the cell a1 contains the formula =c1+b2
I want that all the destination cells have the same formula (=c1+b1)
without the absolute reference.

"Bob Phillips" wrote in message ...
Max,

You need to change the original formula to an absolute reference. For
example, if the formula is =A1+B1, change it to =$A$1+$B$1

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Max_Venezia" wrote in message
om...
I wanted to repeat a formula contained into an initial cell in another
group of cells.
I selected the initial formula in this manner:

ActiveCell.select
x=Selection.formula

then I selected a group of cells
and I wanted to repeat the same formula contained in the initial cell
into these cells

I wrote:
SelectedRange.formula=x

In this way the furmulas I find in the new cells are not equal to the
initial one but
they change from cell to cell according to the position.
If I want to repeat exactly the initial formula in these new cells
regardless of the cell positions what kind of instruction I have to
use?

Thank you in advance.
Max


Dianne

formulas
 
How about:

Sub CopyFormula()

Dim cell As Range
Dim strFormula As String

strFormula = ActiveSheet.Range("A1").Formula
' change the range to whatever your destination range is
For Each cell In ActiveSheet.Range("A3:A5")
cell.Formula = strFormula
Next cell

Set cell = Nothing

End Sub

--
HTH,
Dianne

In om,
Max_Venezia typed:
The fact is that the original formula has not absolute reference and
it is correct. i want to transfer the same formula into another cell.
for example if the cell a1 contains the formula =c1+b2
I want that all the destination cells have the same formula (=c1+b1)
without the absolute reference.

"Bob Phillips" wrote in message
...
Max,

You need to change the original formula to an absolute reference. For
example, if the formula is =A1+B1, change it to =$A$1+$B$1

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Max_Venezia" wrote in message
om...
I wanted to repeat a formula contained into an initial cell in
another group of cells.
I selected the initial formula in this manner:

ActiveCell.select
x=Selection.formula

then I selected a group of cells
and I wanted to repeat the same formula contained in the initial
cell into these cells

I wrote:
SelectedRange.formula=x

In this way the furmulas I find in the new cells are not equal to
the initial one but
they change from cell to cell according to the position.
If I want to repeat exactly the initial formula in these new cells
regardless of the cell positions what kind of instruction I have to
use?

Thank you in advance.
Max




Max_Venezia

formulas
 
Dianne,
Thank you very much.
Max


All times are GMT +1. The time now is 04:21 PM.

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