I have a workbook with 2 sheets. Sheet 1 named "details" sheet 2 named "rec". There are named ranges for each data range which I can manage dynamically.
I am only wanting to transfer data from "details" to "rec" that is within the criteria I have selected. For example, the date and the details (id).
Below is the code I have thus far but it does not deliver the results I need:
Sub transfer_icbr(id As String)
Dim shtF As Worksheet, shtT As Worksheet
Dim lNumRows As Long
Dim lastUpdate As String
lastUpdate = "29/01/2014"
'turn off updates to speed up code execution ->
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
.DisplayAlerts = False
startDate = lastUpdate
Set shtT = ThisWorkbook.Sheets("details")
Set shtF = ThisWorkbook.Sheets("rec")
.AutoFilter Field:=1, Criteria1:= _
">=" & Format(startDate, "mm/dd/yyyy"), Operator:=xlAnd, Criteria2:="<=" & Format(startDate, "mm/dd/yyyy")
.AutoFilter Field:=5, Criteria1:="=id"
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
.DisplayAlerts = True
I have attached a sample file without the above code in it. I have also highlighted the data columns yellow for the criteria and the other color is the actual data (columns A, B, C, G, H & I) to copy out to the "rec" sheet.
Anyone able to help?