Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default How to print select months from worksheet

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default How to print select months from worksheet

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,071
Default How to print select months from worksheet

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
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
Select Worksheet to print Macro Angel_24477616 Excel Worksheet Functions 0 March 19th 07 01:56 PM
How do I select 13 months from a data range for charts marg Charts and Charting in Excel 3 March 14th 07 07:30 AM
Create a print macro that would automatically select print area? wastedwings Excel Worksheet Functions 7 August 22nd 05 10:36 PM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 5th 05 01:03 AM
In Excel 2000, How do you select the whole of a worksheet (Select. Rascal Excel Discussion (Misc queries) 1 March 5th 05 12:59 AM


All times are GMT +1. The time now is 07:42 PM.

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

About Us

"It's about Microsoft Excel"