#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default Print Area

Hi,
I have a macro that filters data to a worksheet I then want the user to view
and print the filtered area if they want. So I have this macro that prints a
thru k problem is it doesn't just print the area with data it keeps print all
the way down the page. Can anyone tell me what I need to add to just print
the area that changes.

Sub PrintActiveSheet()
'
' PrintActiveSheet Macro
' Macro created 4/17/2005 by Jennifer S. Klever
ActiveSheet.Unprotect
'Sort active range
Worksheets("FilterDate").Range("A7").Sort _
Key1:=Worksheets("FilterDate").Columns("a"), _
Key2:=Worksheets("filterDate").Columns("b"), _
Header:=xlGuess
'Print range column a thru K
ActiveSheet.PageSetup.PrintArea = "a" & SRow & ":K" & ERow
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.BlackAndWhite = True
.PrintComments = xlPrintNoComments
.LeftFooter = "MFV"
.RightFooter = "&d"
.CenterHorizontally = True

End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, collate:=True

End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Print Area

seems ok to me...
Sub PrintActiveSheet()
Dim srow As Long
Dim erow As Long
srow = 2
erow = 99

'Print range column a thru K
ActiveSheet.PageSetup.PrintArea = "a" & srow & ":K" & erow
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.BlackAndWhite = True
.PrintComments = xlPrintNoComments
.LeftFooter = "MFV"
.RightFooter = "&d"
.CenterHorizontally = True
ActiveSheet.PrintPreview
End With
ActiveSheet.PrintPreview

End Sub



"Jennifer" wrote:

Hi,
I have a macro that filters data to a worksheet I then want the user to view
and print the filtered area if they want. So I have this macro that prints a
thru k problem is it doesn't just print the area with data it keeps print all
the way down the page. Can anyone tell me what I need to add to just print
the area that changes.

Sub PrintActiveSheet()
'
' PrintActiveSheet Macro
' Macro created 4/17/2005 by Jennifer S. Klever
ActiveSheet.Unprotect
'Sort active range
Worksheets("FilterDate").Range("A7").Sort _
Key1:=Worksheets("FilterDate").Columns("a"), _
Key2:=Worksheets("filterDate").Columns("b"), _
Header:=xlGuess
'Print range column a thru K
ActiveSheet.PageSetup.PrintArea = "a" & SRow & ":K" & ERow
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.BlackAndWhite = True
.PrintComments = xlPrintNoComments
.LeftFooter = "MFV"
.RightFooter = "&d"
.CenterHorizontally = True

End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, collate:=True

End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 385
Default Print Area

I even copied and pasted what you wrote. I am still geting 28 pages with
headings and column k is not fitting in the page. Only a thru j and then k
few pages back. Now in Column L i have formulas all the way to L500 could
this be affecting it?

"Patrick Molloy" wrote:

seems ok to me...
Sub PrintActiveSheet()
Dim srow As Long
Dim erow As Long
srow = 2
erow = 99

'Print range column a thru K
ActiveSheet.PageSetup.PrintArea = "a" & srow & ":K" & erow
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.BlackAndWhite = True
.PrintComments = xlPrintNoComments
.LeftFooter = "MFV"
.RightFooter = "&d"
.CenterHorizontally = True
ActiveSheet.PrintPreview
End With
ActiveSheet.PrintPreview

End Sub



"Jennifer" wrote:

Hi,
I have a macro that filters data to a worksheet I then want the user to view
and print the filtered area if they want. So I have this macro that prints a
thru k problem is it doesn't just print the area with data it keeps print all
the way down the page. Can anyone tell me what I need to add to just print
the area that changes.

Sub PrintActiveSheet()
'
' PrintActiveSheet Macro
' Macro created 4/17/2005 by Jennifer S. Klever
ActiveSheet.Unprotect
'Sort active range
Worksheets("FilterDate").Range("A7").Sort _
Key1:=Worksheets("FilterDate").Columns("a"), _
Key2:=Worksheets("filterDate").Columns("b"), _
Header:=xlGuess
'Print range column a thru K
ActiveSheet.PageSetup.PrintArea = "a" & SRow & ":K" & ERow
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.BlackAndWhite = True
.PrintComments = xlPrintNoComments
.LeftFooter = "MFV"
.RightFooter = "&d"
.CenterHorizontally = True

End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True, collate:=True

End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Print Area

Not if you properly set your print area.

Manually, do Insert=Name

Look at the printarea name's refers to. Does it appear correct - what you
expected?

If so, do a manual printPreview - is it correct.

--
Regards,
Tom Ogilvy


"Jennifer" wrote in message
...
I even copied and pasted what you wrote. I am still geting 28 pages with
headings and column k is not fitting in the page. Only a thru j and then k
few pages back. Now in Column L i have formulas all the way to L500 could
this be affecting it?

"Patrick Molloy" wrote:

seems ok to me...
Sub PrintActiveSheet()
Dim srow As Long
Dim erow As Long
srow = 2
erow = 99

'Print range column a thru K
ActiveSheet.PageSetup.PrintArea = "a" & srow & ":K" & erow
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.BlackAndWhite = True
.PrintComments = xlPrintNoComments
.LeftFooter = "MFV"
.RightFooter = "&d"
.CenterHorizontally = True
ActiveSheet.PrintPreview
End With
ActiveSheet.PrintPreview

End Sub



"Jennifer" wrote:

Hi,
I have a macro that filters data to a worksheet I then want the user

to view
and print the filtered area if they want. So I have this macro that

prints a
thru k problem is it doesn't just print the area with data it keeps

print all
the way down the page. Can anyone tell me what I need to add to just

print
the area that changes.

Sub PrintActiveSheet()
'
' PrintActiveSheet Macro
' Macro created 4/17/2005 by Jennifer S. Klever
ActiveSheet.Unprotect
'Sort active range
Worksheets("FilterDate").Range("A7").Sort _
Key1:=Worksheets("FilterDate").Columns("a"), _
Key2:=Worksheets("filterDate").Columns("b"), _
Header:=xlGuess
'Print range column a thru K
ActiveSheet.PageSetup.PrintArea = "a" & SRow & ":K" & ERow
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.FitToPagesWide = 1
.BlackAndWhite = True
.PrintComments = xlPrintNoComments
.LeftFooter = "MFV"
.RightFooter = "&d"
.CenterHorizontally = True

End With
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Preview:=True,

collate:=True

End Sub
--
Though daily learning, I LOVE EXCEL!
Jennifer



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
set area in excel not giving me option to set print area? J Littlebear Excel Discussion (Misc queries) 4 April 23rd 23 09:04 PM
File, print area, clear area, is not working cblind New Users to Excel 2 September 12th 07 04:51 PM
print area across the freeze panes area tom Excel Worksheet Functions 2 January 6th 07 05:23 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
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 07:53 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"