Hi JBeaucaire
Your change will make the macro run just for that particular sheet, what i want is to have the macro applying my instructions to all the sheets but the "Header" sheet.
My workaround is as follows, just tought there would be something that would stop the macro running on that sheet.
It takes quite a while to run this macro thats why i was thinking about a way to remove this sheet from it.
Regards
Joaquim
Sub FormatPrintAreas()
Dim ws As Worksheet, LR As Long, LC As Long
Sheets("HEADER").Unprotect
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Sheets
With ws
LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
LC = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), _
SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
With .PageSetup
.PrintArea = "" & Range("A1", Cells(LR, LC)).Address & ""
'.PrintArea = .Range("A1", .Cells(LR, LC)).Address
.PrintTitleRows = "$1:$2"
.CenterFooter = "Page &P of &N"
.CenterVertically = False
.PrintHeadings = False
.Orientation = xlLandscape
.FirstPageNumber = xlAutomatic
.BlackAndWhite = True
End With
With .Range("A1", .Cells(LR, LC))
.Borders(xlDiagonalDown).LineStyle = xlNone
.Borders(xlDiagonalUp).LineStyle = xlNone
.Borders(xlEdgeLeft).Weight = xlMedium
.Borders(xlEdgeTop).Weight = xlMedium
.Borders(xlEdgeBottom).Weight = xlMedium
.Borders(xlEdgeRight).Weight = xlMedium
.Borders(xlInsideVertical).Weight = xlHairline
.Borders(xlInsideHorizontal).Weight = xlHairline
End With
Sheets("HEADER").Cells.Borders.LineStyle = xlNone
End With
Sheets("HEADER").Range("i20").Select
Next ws
Application.ScreenUpdating = True
Sheets("HEADER").Protect DrawingObjects:=False, Contents:=True, Scenarios:=False
End Sub
Bookmarks