Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default set print area on multiple sheets


I've tried several ways to do this, but haven't been successful yet.
Need to run "printareamacro" on all sheets after Ind_brkdwn.

Sub PRINTING_PLEASE()
Dim sh As Worksheet
'for each sheet in workbook after "ind templates"
x = Sheets("IND_BRKDWN").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
Call printareamacro
End If
Next
'Application.CutCopyMode = False
End Sub
----------------------------------------------------------------------
Sub printareamacro()
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select

With ActiveSheet.PageSetup
.PrintArea = Range("a1").CurrentRegion.Address
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1

With Selection.Font
.Name = "Arial"
.Size = 12
End With
End With
'ActiveSheet.PrintPreview
Cells.EntireColumn.AutoFit
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default set print area on multiple sheets

adjusted the two.

wrong number of arguments or invalid property assignment.




Sub printareamacro()
mySh As Object
With mySh
With .PageSetup
.PrintArea = .Range("a1").CurrentRegion.Address
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

With .Cells.Font
.Name = "Arial"
.Size = 12
End With

.Cells.EntireColumn.AutoFit
'.PrintPreview
End With
End Sub



Sub pRINT_EM()
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
Call printareamacro(mySh:=sh)
End If
Next sh

End Sub
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default set print area on multiple sheets

Option Explicit
Sub PRINTING_PLEASE()
Dim sh As Worksheet
Dim x As Long
'for each sheet in workbook after "ind templates"
x = Sheets("IND_BRKDWN").Index
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
Call printareamacro(mySh:=sh)
End If
Next sh
'Application.CutCopyMode = False
End Sub
Sub printareamacro(mySh As Object)
With mySh
With .PageSetup
.PrintArea = .Parent.Range("a1").CurrentRegion.Address
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

With .Cells.Font
.Name = "Arial"
.Size = 12
End With

.Cells.EntireColumn.AutoFit
'.PrintPreview
End With
End Sub


"J.W. Aldridge" wrote:

adjusted the two.

wrong number of arguments or invalid property assignment.

Sub printareamacro()
mySh As Object
With mySh
With .PageSetup
.PrintArea = .Range("a1").CurrentRegion.Address
.Orientation = xlLandscape
.CenterHorizontally = True
.CenterVertically = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

With .Cells.Font
.Name = "Arial"
.Size = 12
End With

.Cells.EntireColumn.AutoFit
'.PrintPreview
End With
End Sub

Sub pRINT_EM()
For Each sh In ThisWorkbook.Sheets
If sh.Index x Then
Call printareamacro(mySh:=sh)
End If
Next sh

End Sub


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default set print area on multiple sheets

Thanx for all the help!
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
MULTIPLE PRINT AREA Raz Excel Worksheet Functions 3 January 14th 10 09:47 PM
Print area multiple sheets ian bartlett Excel Programming 2 July 5th 08 05:09 PM
setting page setup/print area for multiple sheets [email protected] Excel Discussion (Misc queries) 6 October 27th 07 01:19 PM
Multiple print-area SteveDB1 Excel Programming 6 September 7th 07 12:56 AM
set the print area print multiple tabs veng Excel Discussion (Misc queries) 5 February 12th 05 07:01 PM


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

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"