excel macro-copy formula to entire column?

G

Guest

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.
 
G

Gord Dibben

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top