How to copy formula across a range without starting at original reference?

doge_3

Board Regular
Joined
Apr 11, 2014
Messages
72
Let's say I have some formulas pasted in cells A1 through D1.

I have a col E that has names starting from E5:E20

I'm using the following code right now to paste the formulas from A1:D1 at A5:D20 like this:

Code:
With Sheets("Sheet1")
        .Range("A5:C" & .Cells(.Rows.Count, "E").End(xlUp).Row).Formula = .Range("A2:C2").Formula        
End With

However, at A5, it starts by referencing the things from the first row. I want it to start referencing from the 5th row.

For example, if B1 has the formula =A1*5, my current code pastes into B5 the same thing as B1. I want it to instead use the formula =A5*5.

How can I change the code to do that?
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Your description references Row 1 as the row holding the source formulas and the code example references Row 2.
Assuming it's Row 2 here's one way....

Code:
 With Sheets("Sheet1")
   .Range("A2:C2").Copy
   .Range("A5:C" & .Cells(.Rows.Count, "E").End(xlUp).Row).PasteSpecial (xlPasteFormulas)
 End With
 
Upvote 0

Forum statistics

Threads
1,224,889
Messages
6,181,608
Members
453,055
Latest member
cope7895

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top