Sub Daily_Sales()
Dim xR As Range
Dim D1 As Date
Dim strformat As String
Dim splitstr() As String
Dim str As String
On Error Resume Next
Sheets("DAILY SALES").Range("A2:K1000").Clear
str = InputBox("Please Input The Date You Want to Search" & Chr(10) & Chr(10) & "Input Format ""DD/MM/YY""")
splitstr = Split(str, "/")
D1 = DateSerial(CInt(splitstr(2)), CInt(splitstr(1)), CInt(splitstr(0)))
S1$ = Format(D1, "dd/mm/yy")
Set xR = Range("GROUPING!A1:K10000")
With xR
.AutoFilter
.AutoFilter Field:=2, Criteria1:=S1
Range("GROUPING!A1").CurrentRegion.Copy
Sheets("DAILY SALES").Range("A1").PasteSpecial xlValues
.AutoFilter
End With
Sheets("DAILY SALES").Activate
With Range([K2], [A65536].End(xlUp)) 'set borders
.Borders.LineStyle = xlContinuous
.Borders.Weight = xlThin
.Borders.ColorIndex = xlAutomatic
.Font.Size = 18
.Font.Name = "Times New Roman"
.HorizontalAlignment = xlCenter
.EntireColumn.AutoFit
End With
k = 2 ' for exchange date format
Do Until IsEmpty(Cells(k, 2))
Cells(k, 2).NumberFormatLocal = "dd""/""mm""/""yy;@"
k = k + 1
Loop
Range("A1").Select
End Sub