The red macro is the one that should be linked to the print command or icon
Option Explicit
Public Sub Print_MDL_Calc_Form()
If MsgBox("Print MDL SUMMARY FORM?", vbQuestion + vbYesNo, "") <> vbYes Then Exit Sub
Worksheets("MDL Calc Form").Select
Prepare_MDL_Calc_Form
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
resetHiddenRows
End Sub
Public Function resetHiddenRows()
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim xrow As Long
Dim lstRow As Long
Set ws = Worksheets("MDL Calc Form")
ws.Range(Cells(12, "A"), Cells(100, "A")).EntireRow.Hidden = False
Application.ScreenUpdating = True
End Function
Public Function Prepare_MDL_Calc_Form()
'
' PrintMDL_Calc_Form Macro
'
If ActiveSheet.Name <> "MDL Calc Form" Then Exit Function
Application.ScreenUpdating = False
Dim ws As Worksheet
Dim xrow As Long
Dim lstRow As Long
Set ws = Worksheets("MDL Calc Form")
lstRow = 111
Application.Calculation = xlCalculationManual
For xrow = lstRow To 12 Step -1
If Len(Trim(ws.Cells(xrow, "B").Value)) = 0 Then ws.Cells(xrow, "B").EntireRow.Hidden = True
Next xrow
Application.Calculation = xlCalculationAutomatic
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = "$A$1:$W$111"
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = "FOR MRLLC USE ONLY"
.CenterFooter = ""
.RightFooter = _
"Mean Recovery %: Red font indicates failure, acceptable range 70-130%" & Chr(10) & "Column A: MDL > 1/10 concentration of spike, * indicates failure" & Chr(10) & "Column B: MDL < spike concentrataion, * indicates failure" & Chr(10) & "&P"
.LeftMargin = Application.InchesToPoints(0.236220472440945)
.RightMargin = Application.InchesToPoints(0.236220472440945)
.TopMargin = Application.InchesToPoints(0.748031496062992)
.BottomMargin = Application.InchesToPoints(0.94488188976378)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = False
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Application.ScreenUpdating = True
End Function
Bookmarks