View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Rick A[_2_] Rick A[_2_] is offline
external usenet poster
 
Posts: 7
Default Work with rows returned from AutoFilter

Rob,

You understand correctly.

I'm going to give what you suggest a try.

Thanks,

--
Rick
wrote in message
oups.com...
If I understand correctly...

- You have a sheet containing a number of rows
- When the Autofilter is applied this number is obviously reduced and
you are left with a selection particular selection of existing rows
- You want to grab this filtered selection as a range so you can work
with it?

If this is the case then I think this should work.

<after autofilter has been applied

Set MyRange = Sheet1.UsedRange.SpecialCells(xlCellTypeVisible)


I think that should work. By using the UsedRange property it will
return a range starting with the upper left most point in the
spreadsheet with data in it, right down the lower right most point with
data in it.

If you only wish to return a certain selection of columns though,
you'll need to adjust it to read:-

Sheet1.Range("B1:L" &
Sheet1.UsedRange.Rows.Count).SpecialCells(xlCellTy peVisible)

Obviously replace the "B1:L" to whatever is needed.

I hope I've got the right idea.

Rob