Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is there a way to have a macro look in an excel database that is sorted by
date and find all the records that have a date that is within the current month, then select only those rows and certain columns, e.g., columns D through K and set the print area using that range? The number of records will be different each month, but they will always be contigous. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
1) Set Auto-Filter on. [Only needs to be done once.]
2) Set your print range to D:K [Only needs to be done once.] 3) Figure out which column # you are using for your filter (example uses Column C in the macro for the 'Field') [Only needs to be done once.] 4) Run a macro similar to... Sub FilterMe() Dim strStartDate As String, strEndDate As String strStartDate = _ Application.InputBox(Prompt:="Enter Start Date: ", _ Title:="Filter Period...Syntax 'dd-mmm-yyyy'", Type:=2) '2=text strEndDate = _ Application.InputBox(Prompt:="Enter End Date: ", _ Title:="Filter Period...Syntax 'dd-mmm-yyyy'", Type:=2) '2=text Selection.AutoFilter Field:=3, Criteria1:="=" & _ strStartDate, Operator:=xlAnd, Criteria2:="<=" & strEndDate End Sub 5) Print HTH, -- Gary Brown If this post was helpful, please click the ''''Yes'''' button next to ''''Was this Post Helpfull to you?". "Loris" wrote: Is there a way to have a macro look in an excel database that is sorted by date and find all the records that have a date that is within the current month, then select only those rows and certain columns, e.g., columns D through K and set the print area using that range? The number of records will be different each month, but they will always be contigous. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Date Search | Excel Discussion (Misc queries) | |||
how to search by date | Excel Discussion (Misc queries) | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming | |||
Excel XP VBA code to search all macro code in Excel module for specific search string criteria | Excel Programming | |||
Search by Date | Excel Programming |