ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter using a second column (https://www.excelbanter.com/excel-programming/353251-autofilter-using-second-column.html)

Robert Christie[_3_]

Autofilter using a second column
 
Hi everyone

The code below works Ok until I try to add a line of code to filter on "YES"
in column H.


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 ' Take the
Autofilter off
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 ' force to a
LONG
MySecondDate = Range("K1") * 1 ' force to a LONG
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 to filter on the 8th column?
recorded code:- Selection.AutoFilter Field:=8, Criteria1:="YES"
''' =========

wsdYsr.[g28].Value = wbscWgs.[E6].Value

End sub

TIA
--
Thank you

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


All times are GMT +1. The time now is 08:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com