INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

excel 2010 vba help with AutoFilter.range.copy

excel 2010 vba help with AutoFilter.range.copy

(OP)
Hi, I'm looking for some help with the above. I have:


Set WSNew = Worksheets.Add(After:=Sheets(ActiveSheet.Index))

(*1) My_Range.AutoFilter Field:=5, Criteria1:="=ARBO"
With My_Range.Parent.AutoFilter.range

(*2) .Copy Destination:=WSNew.range("A1")

End With

Now the line at *1 applies the filter as expected, however when I call the line at *2 it pastes everything from the table not just the filtered results. Everything I can find when I search forums etc is that the autofilter.range.copy should copy only the visible rows unless more than 8192. My unfiltered table is 3500 rows. It's got me stumped.

Many thanks in advance.
Martin

RE: excel 2010 vba help with AutoFilter.range.copy

Hi,

CODE

With My_Range.Parent.AutoFilter.Range.EntireRow.SpecialCells(xlCellTypeVisible)
'.... 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: excel 2010 vba help with AutoFilter.range.copy

Even simpler:
With My_Range
    .AutoFilter Field:=5, Criteria1:="=ARBO" 
    .Copy Destination:=WSNew.range("A1") 

combo

RE: excel 2010 vba help with AutoFilter.range.copy

(OP)
Brilliant, Thank you to you both. Both methods work exactly as I wanted.

As I'm sure its the same for everybody who posts here, hours I spent for something that you two have fixed in seconds. A great Post raised for you both.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close