Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Amy Amy is offline
external usenet poster
 
Posts: 165
Default Automatically Changing the Print Area for Pivot Tables

I would like Excel to automatically adjust the print area for a pivot table.
As I select different options, the # of rows change and I have to manually
select the print area to receive the correct printout.

I found one other post about this and I tried to follow the instructions but
I couldn't get it to work. I think I had to write a macro but I'm not sure.
This was what the other thread suggested:

dim i as long
dim j as long
dim rng as range
set rng=range("b1..e1") ' the address of first row of data you want to
print out
j=0
for i = 1 to rng.columns.coun
j=worksheetfunction.max(j,rng.cells(application.Ro ws.Count-rng.Row,1).end(xlup).row)
next i
activesheet.pagesetup.printarea =
rng.Resize(j-rng.row+1,rng.Columns.Count).Address

I consider myself to be an advanced user in Excel but I'm not good with
writing code. I can record a new macro, no problem -- but I'm a novice at
writing one.

If you have a solution to this problem, please write the instructions for a
"dummy". I won't take it personally :)

I am using Excel 2003.

--
Thanks!
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
Plot Area Automatically Expands in Print and Print Preview Myk D. Charts and Charting in Excel 2 March 12th 09 01:41 PM
Dynamically changing print areas for Pivot Tables Todd1 Excel Discussion (Misc queries) 1 August 17th 06 02:55 AM
Macro - Set Print Area for Changing Data Area ksp Excel Programming 5 May 15th 06 10:20 PM
Create a print macro that would automatically select print area? wastedwings Excel Worksheet Functions 7 August 22nd 05 10:36 PM
Changing print area Aaron Excel Discussion (Misc queries) 2 January 9th 05 05:58 PM


All times are GMT +1. The time now is 06:00 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"