PDA

View Full Version : Filling cells with a formula



Klartigue
09-01-2011, 12:39 PM
I have a macro written that fills in for only one cell:

Sub spread()
'
' spread Macro
'
Windows("Bid List.xlsx").Activate

Range("T2").Select
ActiveCell.FormulaR1C1 = "=RC[-10]-RC[-1]"
Range("T2").Select

But I would like the macro to copy this formula down and fill in for every row that exists. How do I write a general macro to copy this formula down for each row that exists?

mikerickson
09-01-2011, 12:47 PM
Selecting is not nessesary
With Workbooks("Bid List.xlsx").Sheets("Sheet1")
With .Range("T:T")
Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlup)).FormulaR1C1 = "=RC[-10]-RC[-1]"
End With
End With

Klartigue
09-01-2011, 01:01 PM
Thanks for the help! One last question..

In my spreadsheet, i have a the following located in column E..starting at cell E2:

A1
cover
A2
cover
A3
cover
etc..

And for each row, I have EVAL values in column S and Spread values in column T. However, I only want to dispaly those values for A1, A2, A3 rows..I dont want those values displayed for the cover rows.

How do I write a macro to have those values displayed for only A1, A2, A3, etc.. and not for the cover rows?

Chabu
09-01-2011, 03:03 PM
That's easy, just put the values of the same function into the spread of the square of the EVAL/2 but only if starting at A1,...
Then cover with values you don't want displayed and state your question so we can understand it. :-)

Now seriously, you will have to state your question better or at least provide a starting spreadsheet...

Greetings

visible2you
09-01-2011, 03:10 PM
Selecting is not nessesary
With Workbooks("Bid List.xlsx").Sheets("Sheet1")
With .Range("T:T")
Range(.Cells(2, 1), .Cells(.Rows.Count, 1).End(xlup)).FormulaR1C1 = "=RC[-10]-RC[-1]"
End With
End With I admire your method.