copy formula to the last used row

N

Newbie

Hi,
I have a worksheet (based on a template) that has data imported into it in
columns A to E.
Columns F to J Row 2 have formulaes that I want to copy down to the last row
that was used.

I have found the last row used by:

LastUsedRow = ActiveSheet.UsedRange.Row + ActiveSheet.UsedRange.Rows.Count -
1

How can I copy the formulas in col F to J into all rows down to the
LastUsedRow
 
P

Pete McCosh

Range("F2:J2").copy destination:=Range("F2:J"& LastUsedRow)

should do it.

Pete
-----Original Message-----
Columns F to J Row 2 have formulaes that I want to copy down to the last row
that was used.
I have found the last row used by:
LastUsedRow = ActiveSheet.UsedRange.Row +
ActiveSheet.UsedRange.Rows.Count -1
How can I copy the formulas in col F to J into all rows
down to the LastUsedRow
 
P

Patrick Molloy

Try:

With Range(Range("A2"),cells(lastrow,"E"))
.Formula = Range("F2:J2").Formula
End With

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Hi,
I have a worksheet (based on a template) that has data imported into it in
columns A to E.
Columns F to J Row 2 have formulaes that I want to copy down to the last row
that was used.

I have found the last row used by:

LastUsedRow = ActiveSheet.UsedRange.Row +
ActiveSheet.UsedRange.Rows.Count -
 
N

Newbie

Thanks but it doesn't copy anything. I don't get an error just nothing
happens

Any ideas?

Thanks again for your help so far
 
P

Pete McCosh

Can't think of anything. I've just tried it here, with
data in cells A2:E15 and some formulae in F2:J2 and:

LastUsedRow = ActiveSheet.UsedRange.Row + _
ActiveSheet.UsedRange.Rows.Count - 1
Range("F2:J2").copy destination:=Range("F2:J"& LastUsedRow)

worked fine.
 
E

Ed

I have this code in a module that I run every week. I hope you can adjust
it to suit your needs.

Ed

' Finds the last entry in Col A for the fill-down
wb3.Activate
wb3.Sheets(1).Select
LastRow = wb3.Sheets(1).Range("A65536").End(xlUp).Row

' Runs the formulas in the last 7 columns down to the bottom
With wb3.Sheets("Sheet1")
.Range("V2:V" & LastRow).FillDown
.Range("W2:W" & LastRow).FillDown
.Range("X2:X" & LastRow).FillDown
.Range("Y2:Y" & LastRow).FillDown
.Range("Z2:Z" & LastRow).FillDown
.Range("AA2:AA" & LastRow).FillDown
.Range("AB2:AB" & LastRow).FillDown
End With

Newbie said:
Hi,
I have a worksheet (based on a template) that has data imported into it in
columns A to E.
Columns F to J Row 2 have formulaes that I want to copy down to the last row
that was used.

I have found the last row used by:

LastUsedRow = ActiveSheet.UsedRange.Row +
ActiveSheet.UsedRange.Rows.Count -
 

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