ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy formula to the last used row (https://www.excelbanter.com/excel-programming/295172-copy-formula-last-used-row.html)

Newbie

copy formula to the last used row
 
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



Pete McCOsh

copy formula to the last used row
 
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


patrick molloy

copy formula to the last used row
 
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 -
1

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

down to the
LastUsedRow


.


Newbie

copy formula to the last used row
 
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
"Pete McCosh" wrote in message
...
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




Pete McCOsh

copy formula to the last used row
 
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.


-----Original Message-----
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
"Pete McCosh" wrote in message
...
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



.


Ed[_9_]

copy formula to the last used row
 
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" wrote in 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 -
1

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





Newbie

copy formula to the last used row
 
Brilliant! at last something that works

Thanks very much
"Ed" wrote in message
...
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" wrote in 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 -
1

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








All times are GMT +1. The time now is 11:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com