PC Review


Reply
Thread Tools Rate Thread

autofilter, command to select filtered range?

 
 
matthias
Guest
Posts: n/a
 
      16th Oct 2006
Hello guys,

I apply a autofilter in my macro. It filters a range in column a with
criteria ="Y". Then I want to copy the lines in column a who fulfill
this criteria to a new sheet (also in column a)


what is the command for this?

thankx

 
Reply With Quote
 
 
 
 
Mike Fogleman
Guest
Posts: n/a
 
      16th Oct 2006
I got this from Tom:

Sub CopyFilter()
'by Tom Ogilvy
Dim rng As Range
Dim rng2 As Range

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
End With
If rng2 Is Nothing Then
MsgBox "No data to copy"
Else
Worksheets("Sheet2").Cells.Clear
Set rng = ActiveSheet.AutoFilter.Range
rng.Offset(1, 0).Resize(rng.Rows.Count - 1).Copy _
Destination:=Worksheets("Sheet2").Range("A1")
End If
ActiveSheet.ShowAllData

End Sub

Mike F
"matthias" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello guys,
>
> I apply a autofilter in my macro. It filters a range in column a with
> criteria ="Y". Then I want to copy the lines in column a who fulfill
> this criteria to a new sheet (also in column a)
>
>
> what is the command for this?
>
> thankx
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
select range for pivot table command =?Utf-8?B?UmljaGFyZA==?= Microsoft Excel Programming 3 23rd Oct 2006 06:14 PM
traversing through a filtered range based on another filtered range zestpt Microsoft Excel Programming 4 12th Jul 2004 06:37 PM
VBA - How to select autofilter range in an yet unnamed workbook? Frank Krogh Microsoft Excel Programming 2 25th Mar 2004 02:10 PM
Command to select variable input range =?Utf-8?B?SlBUSUlJ?= Microsoft Excel Misc 1 5th Dec 2003 01:26 PM
Output an access report to excel files with filtered a filtered date range. Frank Microsoft Access Form Coding 2 30th Jul 2003 01:03 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:16 AM.