Copy Cells down to Specific Row

shinobi

Board Regular
Joined
Oct 4, 2005
Messages
76
Hi

I have a row of 3 cells with different formulas in them. I'd like to select that row of cells and then copy down to a specific row (defined by the last row of information in a table to the left).

So, for example, I have a table with hard coded data in it from cells A1 to C10. To the right of this, I have three cells that reference that data (D1 to F1). I'd like to copy D1:F1 down to row 10. The original table may change in size, so I can't hard code row 10 as the end point for copying - this needs to be variable.

Can anyone help me do this in my macro using VBA?

Thanks!
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,023
Office Version
  1. 365
Platform
  1. Windows
See if this does what you want:
VBA Code:
Sub MyCopy()

    Dim lr As Long
    
'   Find last row in column A with data
    lr = Cells(Rows.Count, "A").End(xlUp).Row
    
'   Copy formulas from D1:F1 down to last row
    Range("D1:F1").Copy Range("D2:D" & lr)
    
End Sub
 
Solution

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
57,023
Office Version
  1. 365
Platform
  1. Windows
You are welcome.

Hope it makes sense.
Let me know if you have any questions about it.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,201
Messages
5,640,821
Members
417,168
Latest member
StumpoC

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
Top