PDA

View Full Version : Solved: Copying Filtered Data



Rlb53
04-13-2012, 06:23 PM
I'm attempting to copy and paste filtered data within a column.

I recieve and error message that the size of the area to be pasted is not the same as the size of the copied area.

Sheets("savedwork").Activate
Range("k2").Select
Cells(Rows.Count, 1).End(xlUp).SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("plantreportsheet").Activate
Range("a11").PasteSpecial (xlPasteValues)

How may i overcome this error ?

Thanks.

mancubus
04-14-2012, 03:26 PM
try:


Worksheets("savedwork").Range("K2").CurrentRegion.SpecialCells(xlCellTypeVisible).Copy _
Destination:=Worksheets("plantreportsheet").Range("A11")

Rlb53
04-14-2012, 03:35 PM
Thanks Mancubus !

It does copy the filtered data, but it copies the complete worksheet.
How may I restrict it to only the data in Column K beginning with Cell K2?

mancubus
04-14-2012, 04:07 PM
you're wellcome.

try this:


Worksheets("savedwork").Range(Range("K2"), Range("K2").End(xlDown)).Copy _
Destination:=Worksheets("plantreportsheet").Range("A11")

Rlb53
04-14-2012, 04:12 PM
Hmmm.....

Application defined or object defined error....

mancubus
04-14-2012, 04:32 PM
Dim LastRow As Long
With Worksheets("savedwork")
LastRow = .Range("K" & Rows.Count).End(xlUp).Row
.Range("K2:K" & LastRow).Copy Worksheets("plantreportsheet").Range("A11")
End With

Rlb53
04-14-2012, 05:56 PM
Perfect !.... Thank you So Much !

mancubus
04-15-2012, 01:33 PM
you're wellcome