Autofill down or Copy down 1 Row

Kangah

Board Regular
Joined
Feb 9, 2009
Messages
54
Hi All,

I have what I think should be an easy question but can't figure it out and Google isn't turning much up either...

I have a spreadsheet and I want a macro that will find the last row that contains data and simply copy it down one additional row...

If possible, it would be great if it could copy down the format and Data validation but not the actual contents (Otherwise I will just need to add a section that finds the last row, selects it and clears contents).

What would I do it find the last row with data and then copy down just one row?

Thanks in advance guys!

AB
1Test 1Data Validation (Dropdown Box)
2Test 2Data Validation (Dropdown Box)
3Test 3Data Validation (Dropdown Box)
4

<tbody>
</tbody>
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Sorry, I was going to specify that I already know how to identify the last row but I din't want to limit the thinking to trying to get that particular type to work (especially if someone had a better way).

What I need to do is then select that entire row (From A & RowCount to J & RowCount) and Copy it down one row. The problem is that this changes as more rows are added each day.

What I was trying is;

Code:
Sub Add()


Dim RowCount As Integer
     RowCount = Worksheets("Orders").Cells(Rows.Count, "B").End(xlUp).Row
        
Dim RowPlus As Integer
     RowPlus = Worksheets("Orders").Cells(Rows.Count, "B").End(xlUp).Row + 1
    
Worksheets("Orders").Range("A" & RowCount & ":" & "J" & RowCount).AutoFill Destination:=Worksheets("Orders").Range("A" & RowPlus & ":" & "J" & RowPlus)


End Sub
 
Upvote 0
Kangah

I'd be very surprised if your autofill statement doesn't return an error.

Try :-
Code:
Worksheets("Orders").Range("A" & RowCount & ":" & "J" & RowCount).AutoFill Destination:=Worksheets("Orders").Range("A" & RowCount & ":" & "J" & RowCount).Resize(2)

You can then remove the definition of RowPlus and all references to it.

NB for an Autofill the destination must include the source.

hth
 
Upvote 0
Kangah

I'd be very surprised if your autofill statement doesn't return an error.

Try :-
Code:
Worksheets("Orders").Range("A" & RowCount & ":" & "J" & RowCount).AutoFill Destination:=Worksheets("Orders").Range("A" & RowCount & ":" & "J" & RowCount).Resize(2)

You can then remove the definition of RowPlus and all references to it.

NB for an Autofill the destination must include the source.

hth

Thanks very much for that! It works perfectly, and yes I was getting an error... Sort of knew what I wanted to do but the format/referencing just wasn't working for me. Awesome work! :)
 
Upvote 0
Kangah

Thanks for the feedback.

Glad you've got it working now.

Good luck with your project.
 
Upvote 0

Forum statistics

Threads
1,203,100
Messages
6,053,529
Members
444,669
Latest member
Renarian

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