#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default formulas

Dianne,
Thank you very much.
Max
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert Array Formulas to Regular Formulas minyeh Excel Worksheet Functions 0 March 21st 10 05:55 AM
E2007 formulas display as formulas, not results Pierre Excel Worksheet Functions 3 January 14th 10 04:59 PM
Counting # of Formulas in a column with formulas and entered data Brand Excel Worksheet Functions 1 October 10th 09 01:01 PM
CELLS NOT CALC FORMULAS - VALUES STAY SME FORMULAS CORRECT?? HELP Sherberg Excel Worksheet Functions 4 September 11th 07 01:34 AM
Formulas not evaluated, Formulas treated as strings Bob Sullentrup Excel Discussion (Misc queries) 0 November 27th 06 08:01 PM


All times are GMT +1. The time now is 01:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"