macro to copy a function down a list

S

steven

Hi,

this should be fairly easy. I'd like a macro that copies a function (any
function for example a vlookup() function) down in a list. So lets say I have
a list of data and I insert a column (column A), then i put a function (or
anything for that mater) in cell A2 and I want it copied down to lets say
cell A2000.

I want this function to work in any list though no matter how many rows it
has. It has to somehow "see" the where the data rows end in the cells next to
column A, and just copy up to there.

Also column B and C might also be blank and the list might start from column
D for example.

Hope that makes sence. Thank you

Steven.
 
D

Don Guillett

Sub copyformuladown()
lr = Cells(Rows.Count, "a").End(xlUp).Row
Range("b2:b" & lr).FillDown
End Sub
 
T

Tom Ogilvy

Dim rng as Range
set rng = Activesheet.UsedRange.Columns(1).cells
Range("A2:A" & rng(rng.count).row).Formula = Range("A2").Formula
 

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