Solved

how to create a dynamic print area

Posted on 2014-01-10
7
447 Views
Last Modified: 2014-01-14
hi Folks
How can I create a print area in Excel 2010 to be dynamic so that when new data is added, the print area expands automatically? Thank you
0
Comment
Question by:agwalsh
7 Comments
 
LVL 50

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 200 total points
ID: 39770693
0
 
LVL 3

Assisted Solution

by:Sreeram
Sreeram earned 100 total points
ID: 39770712
HI

Using Macro also can be done

sample code:

Sub Macro1()

    With ActiveSheet.PageSetup
        .PrintArea = "$A$1:$D$" & lastinsertedrow
    End With
   
End Sub

Note:

lastinsertedrow - insert the last used row number


this code will set the print area to the range A1 to Dlastinsertedrow
0
 
LVL 50

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 200 total points
ID: 39770816
HI,

With a macro, I would rather do it like this so you have it all automatic

Sub Macro1()
    With ActiveSheet
        .PageSetup.PrintArea = .UsedRange.Address
    End With
End Sub

Open in new window

Regards
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 4

Assisted Solution

by:yuppydu
yuppydu earned 100 total points
ID: 39775892
Why don't you simply create a variable range name and point to it?

If what you need to print is in range A1 to C40 on Sheet1 and you add items either vertically or horizontally you can name the range as PrintRange and input the following string in the Refers to:
=OFFSET(Sheet1!$A$1;0;0;COUNT(Sheet1!A:A);COUNT(Sheet1!1:1))

Then you print PrintRange
0
 
LVL 33

Accepted Solution

by:
Rob Henson earned 100 total points
ID: 39776318
Do you want the Print Area to be all rows and all columns of the Active Sheet.

If so, just delete the Print Area settings altogether and let the Automatic Print Range to kick in.

Thanks
Rob H
0
 

Author Comment

by:agwalsh
ID: 39778681
What I did in the end was a version of what was here. I set up a dummy print area and then amended the Print Range range name to read ='Name of Sheet'!$A:$A,'Name of Sheet'!$1:$2
And that actually worked well. Checked it with adding and deleting rows and it worked fine. But thank you all :-)
0
 

Author Closing Comment

by:agwalsh
ID: 39778685
I've given you all equal marks to say thank you...but I've marked RobHenson's one as best because it was the closest to what worked for me. But THANK YOU to all of you :-)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question