Copying Only One Column of a Filtered Table

Senior

New Member
Joined
Apr 5, 2011
Messages
6
I have a worksheet with a unique number in column A "NumberList" and other columns of data. Autofiltering is on. I need to filter the worksheet on column 13, then copy the contents of displayed cells in column A to another worksheet.

In 2001, Dave provided an elegant response to a similar question, now in the archive, #12560:

Sub SetFilteredRange()
Dim FilterRange As Range

'Offset 1 Row to exclude headings
Set FilterRange = ActiveSheet.UsedRange.Offset(1, 0) _
.SpecialCells(xlCellTypeVisible)

FilterRange.Copy Destination:=Sheets("Sheet2").Range("A1")
End Sub

That code works perfectly except that it copies all columns of displayed data to Sheet2, but I need to copy only column A.

This might help:
Filter Sheet1 on column 13="Yes" 'there are 10 values
Select Column A
Copy Displayed cells from Column A
Paste values only at Sheet2, cell A5 'The 10 values will fill cells A5:A14
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
One workaround is to temporarily hide the unrequired columns in Sheet1 - not very elegant though and it increases processing time.
 
Upvote 0
How about ...

Code:
Sub SetFilteredRange()
    On Error Resume Next
    ActiveSheet.UsedRange.Offset(1).Columns(1).SpecialCells(xlCellTypeVisible).Copy _
            Destination:=Worksheets("Sheet2").Range("A1")
End Sub
And if the data is actually hidden by filter (rather than just hidden),
Code:
Sub SetFilteredRange()
    ActiveSheet.UsedRange.Offset(1).Columns(1).Copy _
            Destination:=Worksheets("Sheet2").Range("A1")
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,073
Messages
6,128,644
Members
449,461
Latest member
kokoanutt

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