select a range on VISIBLE cells in a column

keith

Board Regular
Joined
Mar 3, 2002
Messages
88
I need a macro to select and copy a range (or otherwise define a range) in a single column of a list excluding hidden rows. I can't manually define the Cells because the hidden rows change based on filters. So AFTER the list is filtered it hides a bunch of rows based on the criteria of the filter. I need to copy say the 1st 10 VISIBLE cells in column "C" after the filter. Let me know if I can clarify more.. thanks in advance
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
On 2002-09-03 12:32, keith wrote:
I need a macro to select and copy a range (or otherwise define a range) in a single column of a list excluding hidden rows. I can't manually define the Cells because the hidden rows change based on filters. So AFTER the list is filtered it hides a bunch of rows based on the criteria of the filter. I need to copy say the 1st 10 VISIBLE cells in column "C" after the filter. Let me know if I can clarify more.. thanks in advance

Is the range you need just the 1 Column in width, or does this problem expand?

if it is in Column C and you had C1:C1000 as the range (unfiltered 1000rows below the field name).
Then you can just use the range, i.e.

Sub CopyFilter()

Range("C1:C1000").Copy
Sheets(2).Select
Range("a1").PasteSpecial Operation:=xlPasteSpecialOperationNone

End Sub

will copy the range visable to to sheet2 a1 and down,
as copying the range (inc. the hidden rows) will just copy the visable cells.
 
Upvote 0
I have just re-read your post, sorry, I see you need only the first 10 visable.
BUT, the copy part should work as it does ignore blanks.
I'll have think, someone will doubt less get here first.
 
Upvote 0
But here a big old cheat:

Sub CopyFilter()

Range("C1:C1000").Copy
Sheets(2).Range("a1").PasteSpecial Operation:=xlPasteSpecialOperationNone
Sheets(2).Range("a12:a1000").Delete
End Sub
 
Upvote 0
I think I might can make this work or at least you have me on the right track..

Thanks
 
Upvote 0

Forum statistics

Threads
1,222,228
Messages
6,164,724
Members
451,912
Latest member
HMF009

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