Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jollychang/960455 to your computer and use it in GitHub Desktop.
Save jollychang/960455 to your computer and use it in GitHub Desktop.
filter_and_split_by_select_date
Attribute VB_Name = "split_by_date"
Function split_by_date(start_date)
'
' For My Darling Lotusblue :)
Sheets(1).Select
Cells.Select
Selection.AutoFilter
ActiveSheet.Cells.AutoFilter Field:=5, Criteria1:=Array( _
"sch-Date", "="), Operator:=xlFilterValues, Criteria2:=Array(2, start_date)
Cells.Select
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
Cells.Select
ActiveSheet.Paste
Columns("B:B").Select
Selection.EntireColumn.Hidden = True
Columns("C:C").Select
Selection.EntireColumn.Hidden = True
Columns("F:F").Select
Selection.EntireColumn.Hidden = True
Columns("I:I").Select
Selection.EntireColumn.Hidden = True
Cells.Select
Selection.RowHeight = 15
sheet_count = Sheets.Count
Sheets(sheet_count).Select
Sheets(sheet_count).Name = CStr(Month(start_date)) + "-" + CStr(Day(start_date))
End Function
Sub Run()
'change for from date
from_date = "5/11/2011"
'change for total day
n = 2
For i = 0 To n
da = DateValue(from_date) + i
strDate = CStr(da)
split_by_date strDate
Next i
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment