Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

macro for multi wk sheets

Status
Not open for further replies.

cwash

Technical User
May 27, 2002
45
US
i have a wk book that has several wk sheets. the wk sheets are identical except for the name of the months. (it's a time sheet work book/with a wk sheet for every month) the macro is needed to print the same assigned print area for each work sheet.

ex: mid month i need it to print the range of a1:d12 in the may wk sheet
then at the end of the month i need to print a15:d27 of the same may wk sheet

now come the month of june, i would like to have the same macro print the same range (a1:d12) since all wk sheets are identical, but in the june month

is this possible or do i have to create 24 macros? (two for each month of the year)

i look forward to my answer
 
If you create two macro print routines, mid-month and EOM, then assign each to a macro button. Test and copy to each sheet.

The fact that you are "on" the desired sheet (month) means that the macro will print the cell range from that sheet only.

So to answer your question, just 2 macro routines would be required.
 
Another approach for your consideration is to create a 13th sheet for the current month and print this sheet. To make it reference the current month do something like this:

Name all sheets by the name of the month. In the "Current" sheet put the following
a1: Month
b1: May (name of the current month) - name b1 as range "_month"
a3: =INDIRECT(_month&"!a1")
a3..d15: (as per a3 formula)


So when you change the value in _month to "June" it'll pull the values off that sheet. You could extend this for your EOM requirement of course. And all without a single macro!
 
Thanks for the info...I got it to work with the two original macros.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top