Solved

how to create a dynamic print area

Posted on 2014-01-10
7
414 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 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 200 total points
Comment Utility
0
 
LVL 3

Assisted Solution

by:Sreeram
Sreeram earned 100 total points
Comment Utility
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 48

Assisted Solution

by:Rgonzo1971
Rgonzo1971 earned 200 total points
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 4

Assisted Solution

by:yuppydu
yuppydu earned 100 total points
Comment Utility
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 31

Accepted Solution

by:
Rob Henson earned 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
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.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now