billandrew
Well-known Member
- Joined
- Mar 9, 2014
- Messages
- 743
Trying to filter worksheet on date less than 6/5/2018 using the below code. Perplexed....
Thank you for any help.
Thank you for any help.
Code:
Sub DateLessThan()Dim Lastrow As Long, i As Long
Dim ws As Worksheet
Set ws = ActiveSheet
Dim sdate As String
sdate = 6 / 5 / 2018
Lastrow = Range("A" & Rows.Count).End(xlUp).Row
If ws.AutoFilterMode Then ActiveSheet.AutoFilterMode = False
ws.Range("A1:E1").AutoFilter field:=1, Criteria1:="<=" & sdate
End Sub