Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Display "this week" column headers w/date & day of week? Ivan Wiegand Excel Worksheet Functions 9 September 12th 07 05:18 PM
Macro to concatenate into "B1" B2 thru B"x" based on new data in "Col A" Dennis Excel Discussion (Misc queries) 0 July 17th 06 02:38 PM
"Clean Me" Macro is giving "#VALUE!" error in the Notes field. Ryan Watkins Excel Programming 1 June 11th 05 12:25 AM
Sending macro based e-mail with built-in "Heading" and "Text" Prabha Excel Programming 3 January 17th 05 02:11 PM


All times are GMT +1. The time now is 11:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"