boc_est1986
07-27-2011, 03:23 AM
I have an input form which asks people to put in a date range (date from and date to) i then want to apply a filter on the column between the inputted date range. When the filter is applied the cells all go blank as if nothing meets the criteria. If i manual click on the filter then go into custom the correct dates are in there and if i click ok the data shows up. Can anyone help?
Here is my code
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = Excel.Application
Set xlBook = xlApp.Workbooks.Open("X:\Procurement\VSM Machining\First Article Inspection\First Article Database Machining.xls")
Set xlSheet = xlBook.Sheets("FIRST ARTICLE INSPECTION")
xlSheet.Activate
Range("AB1") = UserForm1.ComboBox1.Text
Range("AC1") = UserForm1.TextBox1.Text
Range("AD1") = UserForm1.TextBox2.Text
Range("B2:Z2").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=Range("AB1")
Selection.AutoFilter Field:=13, Criteria1:=">=" & Range("AC1"), Operator:= _
xlAnd, Criteria2:="<=" & Range("AD1")
Range("B2").Select
Here is my code
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = Excel.Application
Set xlBook = xlApp.Workbooks.Open("X:\Procurement\VSM Machining\First Article Inspection\First Article Database Machining.xls")
Set xlSheet = xlBook.Sheets("FIRST ARTICLE INSPECTION")
xlSheet.Activate
Range("AB1") = UserForm1.ComboBox1.Text
Range("AC1") = UserForm1.TextBox1.Text
Range("AD1") = UserForm1.TextBox2.Text
Range("B2:Z2").Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=Range("AB1")
Selection.AutoFilter Field:=13, Criteria1:=">=" & Range("AC1"), Operator:= _
xlAnd, Criteria2:="<=" & Range("AD1")
Range("B2").Select