ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print area - selection (https://www.excelbanter.com/excel-programming/422362-print-area-selection.html)

al

Print area - selection
 
Macro below is not working properly for my selected cells(range/
region) - can someone help.thxs

Sub Printseuplandscape()
'
' Printseuplandscape Macro
' Macro recorded 12-01-2009 by Albert Ng
'

'
ActiveSheet.Pagesetup.PrintArea = ActiveRange
With ActiveSheet.Pagesetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.Pagesetup.PrintArea = "$A$1:$H$27"
With ActiveSheet.Pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.85)
.BottomMargin = Application.InchesToPoints(0.85)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub

FSt1

Print area - selection
 
hi,
a recorded macro record all of your keyboard and mouse actions.
IF the recorded macro printed correctly when you recorded it, then it should
duplicate your action the next time.
could you be a bit more specific about what is not working?????

"al" wrote:

Macro below is not working properly for my selected cells(range/
region) - can someone help.thxs

Sub Printseuplandscape()
'
' Printseuplandscape Macro
' Macro recorded 12-01-2009 by Albert Ng
'

'
ActiveSheet.Pagesetup.PrintArea = ActiveRange
With ActiveSheet.Pagesetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.Pagesetup.PrintArea = "$A$1:$H$27"
With ActiveSheet.Pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.85)
.BottomMargin = Application.InchesToPoints(0.85)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


al

Print area - selection
 
On Jan 13, 9:58 am, FSt1 wrote:
hi,
a recorded macro record all of your keyboard and mouse actions.
IF the recorded macro printed correctly when you recorded it, then it should
duplicate your action the next time.
could you be a bit more specific about what is not working?????

"al" wrote:
Macro below is not working properly for my selected cells(range/
region) - can someone help.thxs


Sub Printseuplandscape()
'
' Printseuplandscape Macro
' Macro recorded 12-01-2009 by Albert Ng
'


'
ActiveSheet.Pagesetup.PrintArea = ActiveRange
With ActiveSheet.Pagesetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.Pagesetup.PrintArea = "$A$1:$H$27"
With ActiveSheet.Pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.85)
.BottomMargin = Application.InchesToPoints(0.85)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


I would like to use the macro in my personal.xls macro - o that it
sets the page set up for the selected range

FSt1

Print area - selection
 
hi
it 2am in atlanta. crashing here. will look at your post tommorrow.
regards
FSt1

"FSt1" wrote:

hi,
a recorded macro record all of your keyboard and mouse actions.
IF the recorded macro printed correctly when you recorded it, then it should
duplicate your action the next time.
could you be a bit more specific about what is not working?????

"al" wrote:

Macro below is not working properly for my selected cells(range/
region) - can someone help.thxs

Sub Printseuplandscape()
'
' Printseuplandscape Macro
' Macro recorded 12-01-2009 by Albert Ng
'

'
ActiveSheet.Pagesetup.PrintArea = ActiveRange
With ActiveSheet.Pagesetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.Pagesetup.PrintArea = "$A$1:$H$27"
With ActiveSheet.Pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.85)
.BottomMargin = Application.InchesToPoints(0.85)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


FSt1

Print area - selection
 
hi,
try this.....
replace
ActiveSheet.Pagesetup.PrintArea = "$A$1:$H$27"
with
ActiveSheet.Pagesetup.PrintArea = Selection.address

but be careful about what you select. i suspect your margins might effect
what prints also.

Regards
FSt1

"al" wrote:

On Jan 13, 9:58 am, FSt1 wrote:
hi,
a recorded macro record all of your keyboard and mouse actions.
IF the recorded macro printed correctly when you recorded it, then it should
duplicate your action the next time.
could you be a bit more specific about what is not working?????

"al" wrote:
Macro below is not working properly for my selected cells(range/
region) - can someone help.thxs


Sub Printseuplandscape()
'
' Printseuplandscape Macro
' Macro recorded 12-01-2009 by Albert Ng
'


'
ActiveSheet.Pagesetup.PrintArea = ActiveRange
With ActiveSheet.Pagesetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.Pagesetup.PrintArea = "$A$1:$H$27"
With ActiveSheet.Pagesetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "&D-&T"
.CenterFooter = "&P of &N"
.RightFooter = "&Z&F-&F-&A"
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.85)
.BottomMargin = Application.InchesToPoints(0.85)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = True
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


I would like to use the macro in my personal.xls macro - o that it
sets the page set up for the selected range



All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com