Autofilter then Copy and Paste Range

mrkit

New Member
Joined
Nov 30, 2017
Messages
10
The below code was created with intention to autofilter column K with criteria, copy data and paste it at the bottom of the sheet on the same page, just below the last row.


I am not getting any error, but code is not working as intended. It works up to autofilter and copy, but it won't paste the data to the last row. Can I please get some assistance.


Sub Depreciation_to_Zero()
With Sheets("Restaurant")
.AutoFilterMode = False
With .Range("k1", .Range("k" & .Rows.Count).End(xlUp))
.AutoFilter Field:=1, Criteria1:="*HotDog*"
.Offset(1).SpecialCells(xlCellTypeVisible).EntireRow.Copy
.Cells(.Rows.Count, "A").End(xlUp).Row.Select.PasteSpecial xlPasteValues
End With


.AutoFilterMode = False
End With
MsgBox ("Complete")
End Sub
 
Last edited:

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Looks like you are pasting it on the last row, not below it.

Try changing to this

.Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Row.Select.PasteSpecial xlPasteValues
 
Upvote 0

Forum statistics

Threads
1,223,958
Messages
6,175,638
Members
452,663
Latest member
MEMEH

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