Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a worksheet which is typically sorted by date that is added to quite
often. I need to know if there is a way to pull and print only the most recent 3 months worth of data from this sheet. I need to send a report to someone occasionally from this worksheet and instead of having to a) send them the whole thing, b) print preview after sorting to figure out where 3 months ends and print that or c) sort and select print area for what I need to print, I would like to be able to pull that information off a little easier. Is this possible? Is there some formula or something that I can use to do this? Thanks for your help! |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
One question becomes do you mean within the past 3 months or within the past
90 days. But this formula would work for the 3 month deal, example: for date in September, then July, August and September are the 3 months. Use a helper column to achieve this. Assume that you have dates in column A and that your data starts on row 2. Then put this formula in the helper column on row 2: =(YEAR(NOW())-YEAR(A2))*12+MONTH(NOW())-MONTH(A2)<3 This will return TRUE for months in the past 3 months (where current month is one of those 3 months), and FALSE for all others. Then you can filter the data based on that column for TRUE and only the entries for the 3 months will be displayed and you can print the sheet and only those entries will print out. If you meant within the past 90 days, then use this formula instead: =(NOW()-A2)<91 Again, results will be TRUE or FALSE. "pinkluxe" wrote: I have a worksheet which is typically sorted by date that is added to quite often. I need to know if there is a way to pull and print only the most recent 3 months worth of data from this sheet. I need to send a report to someone occasionally from this worksheet and instead of having to a) send them the whole thing, b) print preview after sorting to figure out where 3 months ends and print that or c) sort and select print area for what I need to print, I would like to be able to pull that information off a little easier. Is this possible? Is there some formula or something that I can use to do this? Thanks for your help! |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This macro will set the print range for the last 3 months and print it.
I assumed your dates are in Column A starting with A2 down. I also assumed that you want to print 10 columns including Column A. HTH Otto Sub Testmonth() Dim FourthMonth As Long Dim c As Long Dim FirstCell As Range Dim LastCell As Range Dim RngToPrint As Range Set LastCell = Range("A" & Rows.Count).End(xlUp) If Month(LastCell.Value) 3 Then FourthMonth = Month(LastCell.Value) - 3 Else FourthMonth = Month(LastCell.Value) + 9 End If For c = 1 To 1000 If Month(LastCell.Offset(-c)) = FourthMonth Then Set FirstCell = LastCell.Offset(-c + 1) Exit For End If Next c Set RngToPrint = Range(FirstCell, LastCell).Resize(, 10) RngToPrint.PrintOut End Sub "pinkluxe" wrote in message ... I have a worksheet which is typically sorted by date that is added to quite often. I need to know if there is a way to pull and print only the most recent 3 months worth of data from this sheet. I need to send a report to someone occasionally from this worksheet and instead of having to a) send them the whole thing, b) print preview after sorting to figure out where 3 months ends and print that or c) sort and select print area for what I need to print, I would like to be able to pull that information off a little easier. Is this possible? Is there some formula or something that I can use to do this? Thanks for your help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Select Worksheet to print Macro | Excel Worksheet Functions | |||
How do I select 13 months from a data range for charts | Charts and Charting in Excel | |||
Create a print macro that would automatically select print area? | Excel Worksheet Functions | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) | |||
In Excel 2000, How do you select the whole of a worksheet (Select. | Excel Discussion (Misc queries) |