ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   assigning a formule to each cel in a column (https://www.excelbanter.com/excel-programming/280880-assigning-formule-each-cel-column.html)

solo_razor[_13_]

assigning a formule to each cel in a column
 
hello,

I have a problem, i want to assign every cell from 1 to 200 from a
certain column with a formule that calculates one cel minus another.
E.G.

cel f2 contains 20
cel g2 contains 34
cel h2 must than contain a formula =sum(f2-g2)
The formula self is not difficult using the macro recorder, but i want
to use one formula for an entire column

Regards,
Niek



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/


Mike Fogleman

assigning a formule to each cel in a column
 
This will copy 'Your Formula' down from H2 to where the last number is in
column G.

Range("H2").Select
ActiveCell.FormulaR1C1 = "Your Formula"
Range("H2", Range("G2").End(xlDown)).Offset(0, 1).FillDown

Mike




"solo_razor" wrote in message
...
hello,

I have a problem, i want to assign every cell from 1 to 200 from a
certain column with a formule that calculates one cel minus another.
E.G.

cel f2 contains 20
cel g2 contains 34
cel h2 must than contain a formula =sum(f2-g2)
The formula self is not difficult using the macro recorder, but i want
to use one formula for an entire column

Regards,
Niek



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/




Tom Ogilvy

assigning a formule to each cel in a column
 
Another approach:

Set rng = Range(Cells(2,6),Cells(rows.count,6).End(xlup))
rng.offset(0,2).Formula = "=F2-G2"

Using sum is redundant.

--
Regards,
Tom Ogilvy

"solo_razor" wrote in message
...
hello,

I have a problem, i want to assign every cell from 1 to 200 from a
certain column with a formule that calculates one cel minus another.
E.G.

cel f2 contains 20
cel g2 contains 34
cel h2 must than contain a formula =sum(f2-g2)
The formula self is not difficult using the macro recorder, but i want
to use one formula for an entire column

Regards,
Niek



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/





All times are GMT +1. The time now is 10:11 AM.

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