dynamic "this week" macro
a simple filter does it. just record a macro & examione the code
Sub Macro1()
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=12-Sep-2005", Operator:= _
xlAnd, Criteria2:="<=16-Sep-2005"
End Sub
just change this to a sub and call it ..
sub test
SetDateFilter "12-Sep-2005","16-Sep-2005"
end sub
Sub SetDateFilter(start as string, stop as string)
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="=" & start, Operator:= _
xlAnd, Criteria2:="<=" & stop
End Sub
now alter the calling sub to use cell references to give flexibility
sub test
SetDateFilter format$(range("startdate"),"dd-mm-yy"), _
format$(range("stopdate"),"dd-mm-yy")
end sub
now name a couple of cells as indicated, and assign the sub to a button...
"Bettergains" wrote:
Hello:
I'm feeling a bit lazy on this one: I have a simple sheet with x rows. I
would like to add a button (or sc key) that will sort all rows for "this
weeks" entries): "Show all the entries dated between this Monday and Friday."
I have one date column for these dates. I'm sure someone's already done this,
rather than rtw....
Thanks, germaine
|