#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default AutoFilter

Hi

The code below allows the user to enter two dates to filter on columnA.
i.e = dd-mm-yy and a < dd-mm-yy.

My problem is trying to add columnH to the code to filter for "YES".
The error message is 'Run TIme Error 438
Object doesn't support this property or method.

Sub Transfer_Value() ' IN USE 22-01-2006

Dim dDate As Date
Dim fDate As Date
Dim wsdYsr As Worksheet ' Desination worksheet
Dim wbscWgs As Worksheet ' Source worksheet

Set wsdYsr = Workbooks("Book1.xls").Worksheets("Sheet1")
Set wbscWgs = Workbooks("Book2.xls").Worksheets("Sheet2")

ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = False

dDate = CDate(InputBox("Enter First Day Year"))
[K2].Value = dDate
fDate = CDate(InputBox("Enter First Day of following Year"))
[K1].Value = fDate
MyFirstDate = Range("K2") * 1
MySecondDate = Range("K1") * 1
Rows("8:8").AutoFilter

Rows("8:8").AutoFilter Field:=1, Criteria1:="=" & MyFirstDate, _
Operator:=xlAnd, Criteria2:="<" & MySecondDate

PROBLEM!!
How do I include/add this recorded line of code?
Selection.AutoFilter Field:=8, Criteria1:="YES"

wsdYsr.[G28].Value = wbscWgs.[E6].Value 'Transfer to Sheet2

End sub


--
Thank you

Regards
Aussie Bob C.
Using Windows XP Home + Office 2003 Pro SP2
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default AutoFilter

Maybe....

Selection.AutoFilter Field:=8, Criteria1:="YES"
becomes
rows("8:8").AutoFilter Field:=8, Criteria1:="YES"



Robert Christie wrote:

Hi

The code below allows the user to enter two dates to filter on columnA.
i.e = dd-mm-yy and a < dd-mm-yy.

My problem is trying to add columnH to the code to filter for "YES".
The error message is 'Run TIme Error 438
Object doesn't support this property or method.

Sub Transfer_Value() ' IN USE 22-01-2006

Dim dDate As Date
Dim fDate As Date
Dim wsdYsr As Worksheet ' Desination worksheet
Dim wbscWgs As Worksheet ' Source worksheet

Set wsdYsr = Workbooks("Book1.xls").Worksheets("Sheet1")
Set wbscWgs = Workbooks("Book2.xls").Worksheets("Sheet2")

ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = False

dDate = CDate(InputBox("Enter First Day Year"))
[K2].Value = dDate
fDate = CDate(InputBox("Enter First Day of following Year"))
[K1].Value = fDate
MyFirstDate = Range("K2") * 1
MySecondDate = Range("K1") * 1
Rows("8:8").AutoFilter

Rows("8:8").AutoFilter Field:=1, Criteria1:="=" & MyFirstDate, _
Operator:=xlAnd, Criteria2:="<" & MySecondDate

PROBLEM!!
How do I include/add this recorded line of code?
Selection.AutoFilter Field:=8, Criteria1:="YES"

wsdYsr.[G28].Value = wbscWgs.[E6].Value 'Transfer to Sheet2

End sub

--
Thank you

Regards
Aussie Bob C.
Using Windows XP Home + Office 2003 Pro SP2


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default AutoFilter

Hi and Thank You

I was trying to add the line onto the end of the columnA filter routine
Field:=1.......Field:=8, similiar to a Sort routine with it's Key1..... Key2

All working fine now.
--
Thank you

Regards
Aussie Bob C.
Using Windows XP Home + Office 2003 Pro SP2


"Dave Peterson" wrote:

Maybe....

Selection.AutoFilter Field:=8, Criteria1:="YES"
becomes
rows("8:8").AutoFilter Field:=8, Criteria1:="YES"



Robert Christie wrote:

Hi

The code below allows the user to enter two dates to filter on columnA.
i.e = dd-mm-yy and a < dd-mm-yy.

My problem is trying to add columnH to the code to filter for "YES".
The error message is 'Run TIme Error 438
Object doesn't support this property or method.

Sub Transfer_Value() ' IN USE 22-01-2006

Dim dDate As Date
Dim fDate As Date
Dim wsdYsr As Worksheet ' Desination worksheet
Dim wbscWgs As Worksheet ' Source worksheet

Set wsdYsr = Workbooks("Book1.xls").Worksheets("Sheet1")
Set wbscWgs = Workbooks("Book2.xls").Worksheets("Sheet2")

ActiveSheet.AutoFilterMode = False
Application.ScreenUpdating = False

dDate = CDate(InputBox("Enter First Day Year"))
[K2].Value = dDate
fDate = CDate(InputBox("Enter First Day of following Year"))
[K1].Value = fDate
MyFirstDate = Range("K2") * 1
MySecondDate = Range("K1") * 1
Rows("8:8").AutoFilter

Rows("8:8").AutoFilter Field:=1, Criteria1:="=" & MyFirstDate, _
Operator:=xlAnd, Criteria2:="<" & MySecondDate

PROBLEM!!
How do I include/add this recorded line of code?
Selection.AutoFilter Field:=8, Criteria1:="YES"

wsdYsr.[G28].Value = wbscWgs.[E6].Value 'Transfer to Sheet2

End sub

--
Thank you

Regards
Aussie Bob C.
Using Windows XP Home + Office 2003 Pro SP2


--

Dave Peterson

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
excel 2007 autofilter change to 2003 autofilter functionality? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 10:05 PM
2007 excel autofilter back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 3 April 19th 10 08:11 PM
2007 excel autofilter change back to 2003 autofilter? jonnybrovo815 Excel Discussion (Misc queries) 1 April 19th 10 05:53 PM
2007 Autofilter worse than 2003 Autofilter jsky Excel Discussion (Misc queries) 9 October 31st 07 12:14 AM
How to Sort within AutoFilter with Protection on (and AutoFilter . giblon Excel Discussion (Misc queries) 1 February 16th 06 12:23 PM


All times are GMT +1. The time now is 06:24 PM.

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

About Us

"It's about Microsoft Excel"