L
Lilbit
I have created the following macro which works perfectly:
Sub CreateMnthlySFAReport()
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "MDSummary"
Range("a1, c1, d1, e1, f1, h1, k1, l1, m1, n1, o1, p1, r1, s1, t1,
u1,v1, w1, aa1, ab1, ae1, af1, ag1, ah1, ai1, aj1,
ak1").EntireColumn.Delete
Sheets.Add
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Stage5"
Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Stage4"
Sheets.Add
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "Stage3"
Application.DisplayAlerts = False
Workbooks.Open Filename:="H:\TRWPDOCS\SFA\SFA Report Format.xls"
Cells.Select
Selection.Copy
Windows("SFA Working Sheets.xls").Activate
ActiveSheet.Paste
Sheets("Stage4").Select
Windows("SFA Report Format.xls").Activate
Sheets("Stage4").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("SFA Working Sheets.xls").Activate
ActiveSheet.Paste
Sheets("Stage5").Select
Windows("SFA Report Format.xls").Activate
Sheets("Stage5").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("SFA Working Sheets.xls").Activate
ActiveSheet.Paste
Range("A1").Select
Windows("SFA Report Format.xls").Activate
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
I recorded the following macro to copy the page formatting from the
MDSummary worksheet to the others, but I keep getting an error message.
It works perfectly by itself, but I want to incorporate it in the
above-noted macro. I think I'm just not inserting it correctly. Help!!
Thanks!!
Sheets(Array("Stage3", "Stage4", "Stage5", "MDSummary")).Select
Sheets("MDSummary").Activate
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.3)
.RightMargin = Application.InchesToPoints(0.3)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
Sub CreateMnthlySFAReport()
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "MDSummary"
Range("a1, c1, d1, e1, f1, h1, k1, l1, m1, n1, o1, p1, r1, s1, t1,
u1,v1, w1, aa1, ab1, ae1, af1, ag1, ah1, ai1, aj1,
ak1").EntireColumn.Delete
Sheets.Add
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Stage5"
Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Stage4"
Sheets.Add
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "Stage3"
Application.DisplayAlerts = False
Workbooks.Open Filename:="H:\TRWPDOCS\SFA\SFA Report Format.xls"
Cells.Select
Selection.Copy
Windows("SFA Working Sheets.xls").Activate
ActiveSheet.Paste
Sheets("Stage4").Select
Windows("SFA Report Format.xls").Activate
Sheets("Stage4").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("SFA Working Sheets.xls").Activate
ActiveSheet.Paste
Sheets("Stage5").Select
Windows("SFA Report Format.xls").Activate
Sheets("Stage5").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("SFA Working Sheets.xls").Activate
ActiveSheet.Paste
Range("A1").Select
Windows("SFA Report Format.xls").Activate
ActiveWorkbook.Close
Application.DisplayAlerts = True
End Sub
I recorded the following macro to copy the page formatting from the
MDSummary worksheet to the others, but I keep getting an error message.
It works perfectly by itself, but I want to incorporate it in the
above-noted macro. I think I'm just not inserting it correctly. Help!!
Thanks!!
Sheets(Array("Stage3", "Stage4", "Stage5", "MDSummary")).Select
Sheets("MDSummary").Activate
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.3)
.RightMargin = Application.InchesToPoints(0.3)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With