Sub ElHom1()
'SET BANNERS FOR MONITOR ANOVA
Range("AI1", "BA100").Clear
Range("AN1").Select
With Selection
.Value = "Monitor ANOVA"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Bold = True
.Font.Color = RGB(240, 0, 0)
End With
Range("HomHead").Copy
Range("AK3").PasteSpecial
Range("HomVal").Copy
Range("AI13").PasteSpecial
Range("AJ4").Select
With Selection
.Value = "Mon"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Bold = True
End With
ActiveCell.Copy
ActiveCell.Resize(Range("MonitorTotal").Value).PasteSpecial
Range("AT4").Name = "MonGrandAv"
'APPLY REGRESSION TERMS TO EACH MONITOR BURN
Range("AK4").Select
ActiveCell.FormulaR1C1 = "=Constant1+Factor1*R[-2]C[-18]"
ActiveCell.Copy
Range(ActiveCell, ActiveCell.Offset _
(((Range("MonitorTotal").Value) - 1), 3)).PasteSpecial
'SET BANNERS FOR LOT ANOVA
Range("AN18").Select
With Selection
.Value = "Lot ANOVA"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.Font.Bold = True
.Font.Color = RGB(240, 0, 0)
End With
Range("HomHead").Copy
ActiveCell.Offset(2, -3).Select
ActiveCell.PasteSpecial
Range("HomVal").Copy
ActiveCell.Offset _
(((Range("SamplesPieces").Value) + 2), -2).PasteSpecial
'LOCATE START OF LOT SAMPLE DATA
Columns("D:D").Select
Selection.Find(What:="-2", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
'NAME CELL AT BEGINNING OF SAMPLE DATA "PrevCell"
Set PrevCell = ActiveCell
'COPY SAMPLE NAMES INTO LOT ANOVA TABLE
Range(ActiveCell.Offset(0, -3), _
ActiveCell.Offset(((Range("SamplesPieces").Value) - 1), -3)).Copy
Range("AJ21").PasteSpecial
Range("AV4").PasteSpecial
'SET BANNER FOR LOT SAMPLE DATA BLOCK
Range("AX1").Select
With Selection
.Value = "Lot Sample Drift Data"
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlCenter
.Font.Bold = True
.Font.Color = RGB(240, 0, 0)
End With
Range("AT21").Name = "LotGrandAv"
Range("S1", "V1").Copy
Range("AW3").PasteSpecial
'COPY SAMPLE DATA INTO LOT SAMPLE DRIFT DATA BLOCK
PrevCell.Select
Range(ActiveCell.Offset(0, 1), _
ActiveCell.Offset(((Range("SamplesPieces").Value) - 1), 4)).Copy
Range("AW4").PasteSpecial
'APPLY REGRESSION TERMS TO EACH LOT SAMPLE BURN
'AND PLACE INTO ANOVA TABLE
Range("AK21").Select
ActiveCell.FormulaR1C1 = "=Constant1+Factor1*R[-17]C[12]"
ActiveCell.Copy
Range(ActiveCell, ActiveCell.Offset _
(((Range("SamplesPieces").Value) - 1), 3)).PasteSpecial
'CALCULATE MONITOR HOMONGENEITY PARAMETERS
Range("AO4").Formula = "=Sum(AK4:AN4)"
Range("AP4").Formula = "=(AO4^2)"
Range("AQ4").Formula = "=Sum(AK4^2,AL4^2,AM4^2,AN4^2)"
Range("AR4").Formula = "=Average(AK4:AN4)"
Range("AT4") = Application.Average(Range("AK4", Range("AK4").Offset _
(((Range("MonitorTotal").Value) - 1), 3)))
Range("AS4").Formula = "=(AR4-MonGrandAv)"
Range("AO4", "AS4").Copy
Range("AO4").Resize(Range("MonitorTotal").Value).PasteSpecial
Range("AK4", Range("AK4"). _
Offset(((Range("MonitorTotal").Value) - 1), 8)).Select
'Call RounData
Range("AK14").Formula = "=Sum(AK4:AK12)"
Range("AK14").Copy
Range("AL14", "AN14").PasteSpecial
Range("AO14").Formula = "=Sum(AK14:AN14)"
Range("AK16").Formula = "=(AK14^2)"
Range("AK16").Copy
Range("AL16", "AN16").PasteSpecial
Range("AO16").Formula = "=Sum(AK16:AN16)"
Range("AI14").Name = "MonFree"
Range("MonFree").Formula = "=3*(MonitorTotal-1)"
Range("AJ14") = Range("MonitorTotal")
'MONITOR CRITICAL VALUE FROM TABLE
Sheets("Banners").Select
Range("degfree5").Select
Selection.Find(What:=Range("MonitorTotal").Value, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(0, 1).Copy
Sheets(Range("elcell").Value).Select
Range("AJ16").PasteSpecial
Sheets("Banners").Select
Range("degfree1").Select
Selection.Find(What:=Range("MonitorTotal").Value, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(0, 1).Copy
Sheets(Range("elcell").Value).Select
Range("AJ18").PasteSpecial
'CALCULATE MONITOR SSt
Range("AP14") = (Application.Sum(Range("AP4"). _
Resize(Range("MonitorTotal").Value)) / 4) - ((Range("AO14") ^ 2) / (4 * Range("AJ14")))
'CALCULATE MONITOR SSb
Range("AQ14") = ((Application.Sum(Range("AK16", "AN16"))) _
/ (Range("AJ14"))) - ((((Range("AO14")) ^ 2) / (4 * Range("AJ14"))))
'CALCULATE MONITOR SST
Range("AP16") = (Application.Sum(Range("AQ4").Resize(Range("MonitorTotal").Value)) _
- (((Range("AO14") ^ 2)) / (4 * Range("AJ14"))))
'CALCULATE MONITOR S
Range("AQ16").Value = Sqr(((Range("AP16")) - (Range("AQ14")) - (Range("AP14"))) _
/ (3 * (Range("MonitorTotal") - 1)))
'CALCULATE MONITOR W95
Range("AR14").Value = Range("AJ16") * Range("AQ16") / 2
Range("AR14").Name = "Mon95WVal"
'CALCULATE MONITOR W99
Range("AT16").Value = Range("AJ18") * Range("AQ16") / 2
Range("AT16").Name = "Mon99WVal"
'CALCULATE MONITOR T
Range("AR16").Value = WorksheetFunction.Max(Range("AR4").Resize(Range("MonitorTotal").Value)) _
- WorksheetFunction.Min(Range("AR4").Resize(Range("MonitorTotal").Value))
Range("AR16").Name = "MonTVal"
'MONITOR MAXIMUM RUN AVERAGE
Range("AR18").Value = WorksheetFunction.Max(Range("AR4").Resize(Range("MonitorTotal").Value))
Range("AR18").Name = "MonMaxW"
'MONITOR MINIMUM RUN AVERAGE
Range("AS18").Value = WorksheetFunction.Min(Range("AR4").Resize(Range("MonitorTotal").Value))
Range("AS18").Name = "MonMinW"
'MONITOR MAXIMUM (RUN AVERAGE - MONITOR GRAND AVERAGE)
Range("AS14").Value = WorksheetFunction.Max(Range("AS4").Resize(Range("MonitorTotal").Value))
'MONITOR MINIMUM (RUN AVERAGE - MONITOR GRAND AVERAGE)
Range("AS16").Value = WorksheetFunction.Min(Range("AS4").Resize(Range("MonitorTotal").Value))
'MONITOR STANDARD DEVIATION
Range("AT14").Value = WorksheetFunction. _
StDev(Range("AR4").Resize(Range("MonitorTotal").Value))
Range("AT14").Name = "MonStDev"
'CALCULATE LOT HOMONGENEITY PARAMETERS
Range("AO21").Formula = "=Sum(AK21:AN21)"
Range("AP21").Formula = "=(AO21^2)"
Range("AQ21").Formula = "=Sum(AK21^2,AL21^2,AM21^2,AN21^2)"
Range("AR21").Formula = "=Average(AK21:AN21)"
Range("AT21") = Application.Average(Range("AK21", Range("AK21").Offset _
(((Range("SamplesPieces").Value) - 1), 3)))
Range("AS21").Formula = "=(AR21-LotGrandAv)"
Range("AO21", "AS21").Copy
Range("AO21").Resize(Range("SamplesPieces").Value).PasteSpecial
Range("AK21", Range("AK21"). _
Offset(((Range("SamplesPieces").Value) - 1), 8)).Select
'Call RounData
'SUM THEN SQUARE EACH LOT RUN
Range("AK" & Range("SamplesPieces").Value + 23).Select
ActiveCell = WorksheetFunction. _
Sum(Range("AK21").Resize(Range("SamplesPieces").Value))
ActiveCell.Offset(2, 0).FormulaR1C1 = "=R[-2]C[0]^2"
Range("AL" & Range("SamplesPieces").Value + 23).Select
ActiveCell = WorksheetFunction. _
Sum(Range("AL21").Resize(Range("SamplesPieces").Value))
ActiveCell.Offset(2, 0).FormulaR1C1 = "=R[-2]C[0]^2"
Range("AM" & Range("SamplesPieces").Value + 23).Select
ActiveCell = WorksheetFunction. _
Sum(Range("AM21").Resize(Range("SamplesPieces").Value))
ActiveCell.Offset(2, 0).FormulaR1C1 = "=R[-2]C[0]^2"
Range("AN" & Range("SamplesPieces").Value + 23).Select
ActiveCell = WorksheetFunction. _
Sum(Range("AN21").Resize(Range("SamplesPieces").Value))
ActiveCell.Offset(2, 0).FormulaR1C1 = "=R[-2]C[0]^2"
'SUM THE SUMS OF EACH LOT RUN THEN SQUARE
Range("AO" & Range("SamplesPieces").Value + 23).Select
ActiveCell = Application.Sum(Range("AK" & Range("SamplesPieces").Value + 23, _
"AN" & Range("SamplesPieces").Value + 23))
ActiveCell.Offset(2, 0).FormulaR1C1 = "=R[-2]C[0]^2"
'LOT DEGREE OF FREEDOM AND SAMPLE TOTAL
Range("AI" & Range("SamplesPieces").Value + 23).Select
ActiveCell.Name = "LotFree"
Range("LotFree").Formula = "=3*(SamplesPieces-1)"
Range("AJ" & Range("SamplesPieces").Value + 23) = Range("SamplesPieces")
'LOT CRITICAL VALUE FROM TABLE
Sheets("Banners").Select
Range("degfree5").Select
Selection.Find(What:=Range("SamplesPieces").Value, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(0, 1).Copy
Sheets(Range("elcell").Value).Select
Range("AJ" & Range("SamplesPieces").Value + 25).PasteSpecial
Sheets("Banners").Select
Range("degfree1").Select
Selection.Find(What:=Range("SamplesPieces").Value, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(0, 1).Copy
Sheets(Range("elcell").Value).Select
Range("AJ" & Range("SamplesPieces").Value + 27).PasteSpecial
'CALCULATE LOT SSt
Range("AP" & Range("SamplesPieces").Value + 23).Select
ActiveCell = (Application.Sum(Range("AP21").Resize(Range("SamplesPieces").Value))) / 4 - _
((ActiveCell.Offset(0, -1) ^ 2) / (4 * Range("SamplesPieces")))
'CALCULATE LOT SSb
Range("AQ" & Range("SamplesPieces").Value + 23).Select
ActiveCell = Application.Sum(Range("AK" & Range("SamplesPieces").Value + 25, _
"AN" & Range("SamplesPieces").Value + 25)) / _
(Range("SamplesPieces")) - ((Range("AO" & Range("SamplesPieces").Value + 23)) ^ 2) / _
(4 * Range("SamplesPieces"))
'CALCULATE LOT SST
Range("AP" & Range("SamplesPieces").Value + 25).Select
ActiveCell = (Application.Sum(Range("AQ21").Resize(Range("SamplesPieces").Value)) _
- ((Range("AO" & Range("SamplesPieces").Value + 23)) ^ 2) / _
(4 * Range("SamplesPieces")))
'CALCULATE LOT S
Range("AQ" & Range("SamplesPieces").Value + 25).Select
ActiveCell.Value = Sqr _
((Range("AP" & Range("SamplesPieces").Value + 25) - _
Range("AQ" & Range("SamplesPieces").Value + 23) - _
Range("AP" & Range("SamplesPieces").Value + 23)) / _
(3 * (Range("SamplesPieces") - 1)))
'CALCULATE LOT W95
Range("AR" & Range("SamplesPieces").Value + 23).Select
ActiveCell.Value = Range("AJ" & Range("SamplesPieces").Value + 25) * _
Range("AQ" & Range("SamplesPieces").Value + 25) / 2
ActiveCell.Name = "Lot95WVal"
'CALCULATE LOT W99
Range("AT" & Range("SamplesPieces").Value + 25).Select
ActiveCell.Value = Range("AJ" & Range("SamplesPieces").Value + 27) * _
Range("AQ" & Range("SamplesPieces").Value + 25) / 2
ActiveCell.Name = "Lot99WVal"
'CALCULATE LOT T
Range("AR" & Range("SamplesPieces").Value + 25).Select
ActiveCell.Value = WorksheetFunction.Max(Range("AR21").Resize(Range("SamplesPieces").Value)) _
- WorksheetFunction.Min(Range("AR21").Resize(Range("SamplesPieces").Value))
ActiveCell.Name = "LotTVal"
'LOT MAXIMUM RUN AVERAGE
Range("AR" & Range("SamplesPieces").Value + 27).Select
ActiveCell.Value = WorksheetFunction.Max(Range("AR21").Resize(Range("SamplesPieces").Value))
ActiveCell.Name = "LotMaxW"
'LOT MINIMUM RUN AVERAGE
Range("AS" & Range("SamplesPieces").Value + 27).Select
ActiveCell.Value = WorksheetFunction.Min(Range("AR21").Resize(Range("SamplesPieces").Value))
ActiveCell.Name = "LotMinW"
'LOT MAXIMUM (RUN AVERAGE - MONITOR GRAND AVERAGE)
Range("AS" & Range("SamplesPieces").Value + 23).Select
ActiveCell.Value = WorksheetFunction.Max(Range("AS21").Resize(Range("SamplesPieces").Value))
'LOT MINIMUM (RUN AVERAGE - MONITOR GRAND AVERAGE)
Range("AS" & Range("SamplesPieces").Value + 25).Select
ActiveCell.Value = WorksheetFunction.Min(Range("AS21").Resize(Range("SamplesPieces").Value))
'LOT STANDARD DEVIATION
Range("AT" & Range("SamplesPieces").Value + 23).Select
ActiveCell.Value = WorksheetFunction. _
StDev(Range("AR21").Resize(Range("SamplesPieces").Value))
ActiveCell.Name = "LotStDev"
'INITIATE REPORT COLUMN
Call ElRep
'FORMAT SAMPLE DATA INTO REPORT COLUMN
Call SampForm
'FORMAT ELEMENT REPORT SYMBOL
Call ElRepForm
'SAVE SHEET AS VALUES ONLY
ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value
'SEND REPORT COLUMN TO REPORT SHEET
Call RepCols
'SAVE REPORT SHEET AS VALUES ONLY
ActiveSheet.UsedRange.Value = ActiveSheet.UsedRange.Value
Sheets("Report").Select
End Sub