Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Print Area to last cell with data

On Jul 8, 4:01 pm, Susan wrote:
Help,

we are constantly adding new data and trying to write a macro (which I am
new to) that will set the print area automatically to the last row with data
in it. Can someone please help me.... I have no idea what i am doing and
the people i am writing this for have less knowledge.

Any help would be appreciated!


try the following macro strip, Of course you will have to determine
where the end of the data is located (i call it lastpos)

ActiveSheet.PageSetup.PrintArea = Range(Cells(1, 1), Cells(lastpos,
15)).Address
printsetup

Application.ScreenUpdating = True

Function printsetup()

With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = "&D"
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.5)
.RightMargin = Application.InchesToPoints(0.5)
.TopMargin = Application.InchesToPoints(0.5)
.BottomMargin = Application.InchesToPoints(0.5)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 300
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
End Function
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
Print area giving me 1 page per cell Coop Excel Discussion (Misc queries) 4 September 19th 07 05:36 AM
Sorting data to a 'print' area ?? Ian Excel Discussion (Misc queries) 0 March 16th 06 08:10 PM
Pivot Table macro to set print area and print details of drill down data Steve Haskins Excel Discussion (Misc queries) 2 December 28th 05 04:59 PM
Active cell counting in particular print page (one sheet having different print area) ananthmca2004 Excel Worksheet Functions 1 November 24th 05 11:29 AM
How do you turn off a print area for a page? (no print area) Grunen Excel Discussion (Misc queries) 4 October 8th 05 07:46 PM


All times are GMT +1. The time now is 05:29 PM.

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

About Us

"It's about Microsoft Excel"