Sub NewTest()
Dim Response As Integer
Dim LR As Long: LR = Cells(Rows.Count, 17).End(xlUp).Row
Dim i As Long
Dim BR As Long: BR = Cells(Rows.Count, 21).End(xlUp).Row
Dim z As Long
Application.ScreenUpdating = False
' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Have You Updated Report Pages with Player Numbers?", Buttons:=vbYesNo)
' If statement to check if the yes button was selected.
If Response = vbYes Then
'select Weight Report Sheet
Sheets("Ind-Report (Wt)").Select
'Add Look up Formulas below last months test
For i = LR To 3 Step -1
If Not (IsEmpty(Cells(i, 17))) Then
Cells(i, 1).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,2,)"
Cells(i, 2).Select
Selection.Formula = "='Recording Sheet WTs'!$e$1"
Cells(i, 3).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,3,)"
Cells(i, 5).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,8,)"
Cells(i, 6).Select
Selection.Formula = "=iferror((e" & i & ")/(c" & i & "),"""")"
Cells(i, 7).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,5,)"
Cells(i, 8).Select
Selection.Formula = "=iferror(((g" & i & ")*2.2)/(c" & i & "),"""")"
Cells(i, 9).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,11,)"
Cells(i, 10).Select
Selection.Formula = "=iferror((i" & i & ")/(c" & i & "),"""")"
Cells(i, 11).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,12,)"
Cells(i, 12).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,13,)"
Cells(i, 13).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,4,)"
Cells(i, 15).Select
Selection.Formula = "=vlookup(q" & i & ",'Recording Sheet WTs'!$A$5:$N$39,14,)"
End If
Next i
'Select Field report Sheet
Sheets("Ind-Report (Field)").Select
'Add look up formulas below last months test
For z = BR To 3 Step -1
If Not (IsEmpty(Cells(z, 21))) Then
Cells(z, 1).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,2,)"
Cells(z, 2).Select
Selection.Formula = "='Recording Sheet Cond'!$e$1"
Cells(z, 3).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,3,)"
Cells(z, 5).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,4,)"
Cells(z, 7).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,5,)"
Cells(z, 9).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,6,)"
Cells(z, 11).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,7,)"
Cells(z, 13).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,8,)"
Cells(z, 15).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Cond'!$A$5:$N$39,9,)"
Cells(z, 17).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Shuttle'!$A$5:$T$39,15,)"
Cells(z, 19).Select
Selection.Formula = "=vlookup(u" & z & ",'Recording Sheet Shuttle'!$A$5:$T$39,16,)"
End If
Next z
'Clear Last Test Recording forms
Sheets("Recording Sheet WTs").Select
Range("C5:G39").Select
Selection.ClearContents
Range("I5:J39").Select
Selection.ClearContents
Range("L5:N39").Select
Selection.ClearContents
Sheets("Recording Sheet Cond").Select
Range("C5:I39").Select
Selection.ClearContents
Sheets("Recording Sheet Shuttle").Select
Range("C5:J39").Select
Selection.ClearContents
Else
' The no button was selected.
MsgBox "Update Reports then re-click New Test Button"
End If
End Sub
Bookmarks