RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 810
- Office Version
- 365
- Platform
- Windows
Calamity!
Have this autofilter:
Lastrowaf1 is working (12,000 rows), field 12 is the autofilter field (contains date as serial, 44242 etc)
bkdate, bkdate2 and bkdate3 are all declared as LONG and their variables are:
bkdate - 44242
bkdate2 - 44235
bkdate3 - 44228
So each date a week before.
The data in the filter has dates that go from 44200 to 44256, each in 7 day increments and yes, 44242, 44235 and 44228 all appear.
Unfortunately, when I run the line of code above the autofilter returns a blank result.
If I take off "Operator:=xlFilterValues" I then only get 44228 returning, even though there are valid lines for bkdate and bkdate2.
So I'm stuck, any help?
Full code extract:
Thanks!
Have this autofilter:
VBA Code:
Range("A1:W" & Lastrowaf1).AutoFilter field:=12, Criteria1:=Array(bkdate, bkdate2, bkdate3), Operator:=xlFilterValues ' Booking Date
Lastrowaf1 is working (12,000 rows), field 12 is the autofilter field (contains date as serial, 44242 etc)
bkdate, bkdate2 and bkdate3 are all declared as LONG and their variables are:
bkdate - 44242
bkdate2 - 44235
bkdate3 - 44228
So each date a week before.
The data in the filter has dates that go from 44200 to 44256, each in 7 day increments and yes, 44242, 44235 and 44228 all appear.
Unfortunately, when I run the line of code above the autofilter returns a blank result.
If I take off "Operator:=xlFilterValues" I then only get 44228 returning, even though there are valid lines for bkdate and bkdate2.
So I'm stuck, any help?
Full code extract:
VBA Code:
'Calculate origin of bookings, booking by booking
t3.Activate
Range("D:D").NumberFormat = "dd/mm/yyyy"
Range("J:J").NumberFormat = "£#,##0.00"
Range("L:L").NumberFormat = "dd/mm/yyyy"
Range("A3").Activate
Dim strow, erow, bkdate, bkdate2, bkdate3 As Long
Dim csheet As Worksheet
Dim web, london, other As Boolean
Do Until Cells(ActiveCell.Row, "A").Value = ""
bkdate = CLng(Cells(ActiveCell.Row, "L").Value)
bkdate2 = bkdate - 7
bkdate3 = bkdate - 14
tnam = Cells(ActiveCell.Row, "N").Value
pup = Cells(ActiveCell.Row, "E").Value
src = Cells(ActiveCell.Row, "F").Value
af1.Activate
Range("A1:W" & Lastrowaf1).AutoFilter field:=12, Criteria1:=Array(bkdate, bkdate2, bkdate3) ' Booking Date
Range("A1:W" & Lastrowaf1).AutoFilter field:=3, Criteria1:=tnam ' Tour Name
Range("A1:W" & Lastrowaf1).AutoFilter field:=15, Criteria1:="*" & pup & "*" ' Pickup
Range("A1:W" & Lastrowaf1).AutoFilter field:=23, Criteria1:=src ' Source code
If something Then
End If
ActiveCell.Offset(1, 0).Activate
Loop ' main loop
Thanks!