VBA: Copy to bottom of existing data

cmhoz

Active Member
Joined
Aug 20, 2006
Messages
268
I know this has been answered before - I even know I wrote it down - but now I just can't find it!

I have a list of data that grows. Next to the list I have some formulas that need to be copied down to match the growing list of data.

How do I say "copy to bottom of existing data" in VBA?

Thanks!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
cmhoz,

The following will find the last row in Column A (change as required) which contains data:

Code:
Sub LastRow()

Dim lngLastRow As Long

lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row

End Sub

HTH

Robert
 
Upvote 0
Code:
    Range("B1").AutoFill Destination:=Range("B1:B" & Cells(Rows.Count, "A").End(xlUp).Row)

Substitute B for the column you want the formula in, Substitute A for where you can guarantee data to the end and substitute the 1 for whatever row your repetative formula first appears in.

Cheers

Dan
 
Upvote 0
Perhaps this??

Code:
Range("B3:AQ3").AutoFill Destination:=Range("B3:AQ" & Cells(Rows.Count, "A").End(xlUp).Row)
 
Upvote 0
Hi Blade, Thanks for your help.

I have one more question.

I have created this formula that selects the last row with data in Column B

Range("B" & Rows.Count).End(xlUp).Select
Range(Selection, Selection.End(xlToRight)).Select

Once this is selected I need to copy it down to the last row that contains data in Column A

Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,424
Members
448,961
Latest member
nzskater

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