View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default excel macro-copy formula to entire column?

With your formula entered in C1..............

Sub Auto_Fill()
Dim Lrow As Long
With ActiveSheet
Lrow = Range("C" & Rows.Count).End(xlUp).Row
Range("C1:C" & Lrow).FillDown
End With
End Sub


Gord Dibben MS Excel MVP


On Fri, 9 Feb 2007 06:56:01 -0800, kfboudreau
wrote:

i have a large amount of data i need to graph each week. The amount of data
varies each week. I would like to have a macro which creates a formula and
puts it in an adjacent cell to all the rows with data. I have created macros
for this, but it always pastes the formula in the number of rows i had in the
spreadsheet when i created the macro.

For instance, when i record the macro i had 32000 rows. It pastes the
formula in rows 2-32,000. When i pul in new data with 31000 rows, it is still
pasting the formula in rows 2-32,000. How do I get the macro to only paste in
the relative rows?
Thanks.