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

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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

Ian Mac

MrExcel MVP
Joined
Feb 20, 2002
Messages
1,174
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

keith

Board Regular
Joined
Mar 3, 2002
Messages
88
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,195,630
Messages
6,010,780
Members
441,569
Latest member
PeggyLee

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
Top