I am taking on a task of which I have a function of filtering dates to extract data from another worksheet I have never done in VBA. I have two work books which are Project_Summary and Exp_Report, Exp_Report is a query from our PM Module and Project_Summary is a workbook I have built to provide high level and low level project financials in the following steps.
Within Project_Summary, I have a Sheet called Expenditures within which is "Task" and then "Date" which is formatted "mmmm-yyyy" (column D) to be used for criteria to move data from Exp_Report over. See below
Step 1: Within Project_Summary workbook I have VBA code that takes Exp_Report query and sorts/filters this query into a usable report. This part is working good
Step 2: Is to filter the data within Exp_Report by Task and Date then move filtered data to Workbook (Project_Summary) Sheet(Expenditures). I can filter Exp_Report "Task" without issues
Step 3: When I try to filter Exp_Report "Date" based on the dates from Expenditures "Column D" I only clear out all Dates. Below is the code for such I have come up with so far.
Variables I have set
Dim myDate As Date
Dim wsDest As Worksheet
Dim wsCopy As Worksheet
Set wsDest = ThisWorkbook.Sheets("Expenditures")
Set wsCopy = Workbooks("Exp_Report").Sheets("Sheet1")
This is the part of the code I need to use to filter the dates in the Exp_Report I am going to copy
myDate = Range("PMDATE7").Value
wsCopy.Range("$A$1:$G$10000").AutoFilter Field:=2, Criteria1:= _
"02 PROJECT MANAGEMENT"
wsCopy.Range("$A$1:$D$10000").AutoFilter Field:=4, Operator:= _
xlFilterValues, Criteria1:="myDate.Value"
I hope i have given enough information to help.
Within Project_Summary, I have a Sheet called Expenditures within which is "Task" and then "Date" which is formatted "mmmm-yyyy" (column D) to be used for criteria to move data from Exp_Report over. See below
Step 1: Within Project_Summary workbook I have VBA code that takes Exp_Report query and sorts/filters this query into a usable report. This part is working good
Step 2: Is to filter the data within Exp_Report by Task and Date then move filtered data to Workbook (Project_Summary) Sheet(Expenditures). I can filter Exp_Report "Task" without issues
Step 3: When I try to filter Exp_Report "Date" based on the dates from Expenditures "Column D" I only clear out all Dates. Below is the code for such I have come up with so far.
Variables I have set
Dim myDate As Date
Dim wsDest As Worksheet
Dim wsCopy As Worksheet
Set wsDest = ThisWorkbook.Sheets("Expenditures")
Set wsCopy = Workbooks("Exp_Report").Sheets("Sheet1")
This is the part of the code I need to use to filter the dates in the Exp_Report I am going to copy
myDate = Range("PMDATE7").Value
wsCopy.Range("$A$1:$G$10000").AutoFilter Field:=2, Criteria1:= _
"02 PROJECT MANAGEMENT"
wsCopy.Range("$A$1:$D$10000").AutoFilter Field:=4, Operator:= _
xlFilterValues, Criteria1:="myDate.Value"
I hope i have given enough information to help.