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 |
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 |
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 |
All times are GMT +1. The time now is 12:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com