Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Auto filter question

Hello,
What I am trying to do is copy all the results of a filter and paste them to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Auto filter question

Try this

Dim rng As Range
Set rng = Selection
rng.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
rng.SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
rng.Delete
Sheets("Sheet15").Name = "SOI"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lime" wrote in message
...
Hello,
What I am trying to do is copy all the results of a filter and paste them

to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am

assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need

it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Auto filter question

Hi Lime

Try this
http://www.rondebruin.nl/copy5.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lime" wrote in message ...
Hello,
What I am trying to do is copy all the results of a filter and paste them to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Auto filter question

Thanks Bob & Ron. You both were a big help..
The below work well but, it remove the header from the main sheet. All I
need is the filter results and leave the header. Any sugestion?

"Bob Phillips" wrote:

Try this

Dim rng As Range
Set rng = Selection
rng.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
rng.SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
rng.Delete
Sheets("Sheet15").Name = "SOI"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lime" wrote in message
...
Hello,
What I am trying to do is copy all the results of a filter and paste them

to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am

assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need

it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Auto filter question

See the second example on my page

Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, .Columns.Count) _
.SpecialCells(xlCellTypeVisible)


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lime" wrote in message ...
Thanks Bob & Ron. You both were a big help..
The below work well but, it remove the header from the main sheet. All I
need is the filter results and leave the header. Any sugestion?

"Bob Phillips" wrote:

Try this

Dim rng As Range
Set rng = Selection
rng.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
rng.SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
rng.Delete
Sheets("Sheet15").Name = "SOI"


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Lime" wrote in message
...
Hello,
What I am trying to do is copy all the results of a filter and paste them

to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am

assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need

it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Auto filter question

I am placing Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1,
..Columns.Count) _
.SpecialCells(xlCellTypeVisible)
but I keep bugging...

"Ron de Bruin" wrote:

Hi Lime

Try this
http://www.rondebruin.nl/copy5.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lime" wrote in message ...
Hello,
What I am trying to do is copy all the results of a filter and paste them to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Auto filter question

Hi Lime

I think you copy it exact in Bob's example ?

Try this

Sub Delete_with_Autofilter()
Dim DeleteValue As String
Dim rng As Range
Dim rng2 As Range

Set rng = Selection
DeleteValue = "STATE OF ILLINOIS"
rng.AutoFilter Field:=41, Criteria1:=DeleteValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng2 Is Nothing Then
rng.EntireRow.Copy Sheets("Sheet15").Range("A1")
rng2.EntireRow.Delete
End If
End With
ActiveSheet.AutoFilterMode = False
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lime" wrote in message ...
I am placing Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1,
.Columns.Count) _
.SpecialCells(xlCellTypeVisible)
but I keep bugging...

"Ron de Bruin" wrote:

Hi Lime

Try this
http://www.rondebruin.nl/copy5.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lime" wrote in message ...
Hello,
What I am trying to do is copy all the results of a filter and paste them to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 56
Default Auto filter question

Thanks.. Ron
It did not work as I wanted so I just copied the header back over. It seemed
like a logical work around. I really do apreaciate your Help as always.
Lime

"Ron de Bruin" wrote:

Hi Lime

I think you copy it exact in Bob's example ?

Try this

Sub Delete_with_Autofilter()
Dim DeleteValue As String
Dim rng As Range
Dim rng2 As Range

Set rng = Selection
DeleteValue = "STATE OF ILLINOIS"
rng.AutoFilter Field:=41, Criteria1:=DeleteValue
With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng2 Is Nothing Then
rng.EntireRow.Copy Sheets("Sheet15").Range("A1")
rng2.EntireRow.Delete
End If
End With
ActiveSheet.AutoFilterMode = False
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lime" wrote in message ...
I am placing Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1,
.Columns.Count) _
.SpecialCells(xlCellTypeVisible)
but I keep bugging...

"Ron de Bruin" wrote:

Hi Lime

Try this
http://www.rondebruin.nl/copy5.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Lime" wrote in message ...
Hello,
What I am trying to do is copy all the results of a filter and paste them to
a new sheet, and then deleting the rows of filter results from the main
sheet. I will have many different filters following this one so I am assuming
NEXT. Here is what I have so far. But it only copies certain rows, I need it
to copy all of the filter reusts as the results change daily. Any Help...
Thanks,
Lime

Selection.AutoFilter Field:=41, Criteria1:="STATE OF ILLINOIS"
Rows("18:18").Select
Range("AJ18").Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Sheet15").Select
ActiveSheet.Paste
Sheets("Sheet15").Select
Sheets("Sheet15").Name = "SOI"








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-filter Question Brig Excel Discussion (Misc queries) 1 April 5th 08 05:00 AM
Auto-filter question Dallman Ross Excel Discussion (Misc queries) 21 November 23rd 06 03:45 PM
Auto Filter question Michael Raphael Excel Worksheet Functions 3 August 11th 06 04:28 PM
auto filter question Juco Excel Worksheet Functions 0 November 29th 04 02:48 PM
auto filter question Juco Excel Worksheet Functions 1 November 28th 04 02:51 PM


All times are GMT +1. The time now is 02:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"