Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is my code
Sub Copydata() Dim rng As Range Dim rng1 As Range Dim rng2 As Range Dim rng3 As Range Dim rng4 As Range With Worksheets("TOEPIEXP") Set rng = Range("A1").CurrentRegion rng.AutoFilter Field:=24, Criteria1:="0" Set rng2 = .AutoFilter.Range Set rng2 = rng2.Offset(1, 0).Resize( _ rng2.Rows.Count - 1) Set rng3 = .Range("B:B,E:E,V:V,X:X,AD:AD").EntireColumn 'Set rng3 = .Range("B:A,E:B,V:C,X:E,AD:D").EntireColumn Set rng1 = Intersect(rng2.EntireRow, rng3) End With Set rng4 = Worksheets("NetPILIQ") _ .Cells(Rows.Count, 1).End(xlUp)(2) If rng4.Row < 6 Then Set rng4 = Worksheets("NetPILIQ").Range("A6") rng1.Copy rng4 End If End Sub Im getting an autofilter method of range class failed on this line of code. rng.AutoFilter Field:=24, Criteria1:="0" Also What do i need to add to my code to do theses 2 things 1. Remove the filter after the macro is finished. 2. Clear the NetPILIQ worksheet of everything below row 6 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200609/1 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having the same problem with autofilter and it works fine with vbscript
"jln via OfficeKB.com" <u25956@uwe wrote in message news:6624bf0df85b9@uwe... Here is my code Sub Copydata() Dim rng As Range Dim rng1 As Range Dim rng2 As Range Dim rng3 As Range Dim rng4 As Range With Worksheets("TOEPIEXP") Set rng = Range("A1").CurrentRegion rng.AutoFilter Field:=24, Criteria1:="0" Set rng2 = .AutoFilter.Range Set rng2 = rng2.Offset(1, 0).Resize( _ rng2.Rows.Count - 1) Set rng3 = .Range("B:B,E:E,V:V,X:X,AD:AD").EntireColumn 'Set rng3 = .Range("B:A,E:B,V:C,X:E,AD:D").EntireColumn Set rng1 = Intersect(rng2.EntireRow, rng3) End With Set rng4 = Worksheets("NetPILIQ") _ Cells(Rows.Count, 1).End(xlUp)(2) If rng4.Row < 6 Then Set rng4 = Worksheets("NetPILIQ").Range("A6") rng1.Copy rng4 End If End Sub Im getting an autofilter method of range class failed on this line of code. rng.AutoFilter Field:=24, Criteria1:="0" Also What do i need to add to my code to do theses 2 things 1. Remove the filter after the macro is finished. 2. Clear the NetPILIQ worksheet of everything below row 6 -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200609/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
excel 2007 autofilter change to 2003 autofilter functionality? | Excel Discussion (Misc queries) | |||
2007 excel autofilter back to 2003 autofilter? | Excel Discussion (Misc queries) | |||
2007 excel autofilter change back to 2003 autofilter? | Excel Discussion (Misc queries) | |||
2007 Autofilter worse than 2003 Autofilter | Excel Discussion (Misc queries) | |||
How to Sort within AutoFilter with Protection on (and AutoFilter . | Excel Discussion (Misc queries) |