Start autofill based on non-defined cell

peltron

New Member
Joined
Jul 13, 2016
Messages
20
Hello friends,

After searching all over the internet, I have a VBA code here which copies cell AG2 and pastes the data into the first empty cell in column AG. The same process repeats for cell AB2 for the second line.


Range("AG2").Copy Range("AG" & Rows.Count).End(xlUp).Offset(1, 0)
Range("AB2").Copy Range("AB" & Rows.Count).End(xlUp).Offset(1, 0)

My next step would be to auto fill column AG_ and AB_ based on the last cell row in other columns, let's say column A.

I have a code here
Range("AG10:AG10").AutoFill Destination:=Range("AB1:AG" & Cells(Rows.Count, "AA").End(xlUp).Row)

but with this code, I have to select a specific cell AG10 to start the autofill. This does not work as I have previously pasted my data into the first empty cell, which varies from week to week.

Hope that someone can help me out here, thank you!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,224,939
Messages
6,181,878
Members
453,068
Latest member
DCD1872

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