I have a list of engineers and a performance sheet that shows output. I can select and print each one individully but I have been trying to write code to do it automatically. It works fine but only prints the same sheet for all. There are 2 sheets 1 if they have done well and one if they have not. I need it to print the sheet based on how they did. The target is 100% and is in a range called "gross" the sheets to select from are worse (less than 100%) or better (more than 100%). The code I have is here as you can see the two lines that I have tried seem to be ok but only print out the worse sheet for all.
[/code]
Sub PrintEng_00()
'Determines how many engineers there are on selected patch
Sheets("Sheet2").Select
If Range("NumberOfEng").Value = 1 Then PrintEng_01
If Range("NumberOfEng").Value = 2 Then PrintEng_02
If Range("NumberOfEng").Value = 3 Then PrintEng_03
If Range("NumberOfEng").Value = 4 Then PrintEng_04
If Range("NumberOfEng").Value = 5 Then PrintEng_05
If Range("NumberOfEng").Value = 6 Then PrintEng_06
If Range("NumberOfEng").Value = 7 Then PrintEng_07
If Range("NumberOfEng").Value = 8 Then PrintEng_08
If Range("NumberOfEng").Value = 9 Then PrintEng_09
If Range("NumberOfEng").Value = 10 Then PrintEng_10
If Range("NumberOfEng").Value = 11 Then PrintEng_11
Sheets("Sheet2").Select
Range("Eng_Choice").Select
ActiveCell.FormulaR1C1 = "1"
Range("A1").Select
End Sub
Sub PrintEng_01()
' 1 Engineer on the patch
Range("Eng_Choice").Select
ActiveCell.FormulaR1C1 = "1"
If Range("gross").Value >= 100 Then Sheets("Worse").Select
If Range("gross").Value <= 100 Then Sheets("Better").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Sheet2").Select
Range("A1").Select
End Sub
Sub PrintEng_02()
' 2 Engineer on the patch
PrintEng_01
Range("Eng_Choice").Select
ActiveCell.FormulaR1C1 = "2"
If Range("gross").Value >= 100 Then Sheets("Worse").Select
If Range("gross").Value <= 100 Then Sheets("Better").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Sheet2").Select
Range("A1").Select
End Sub
I hope that is clear enough
Thanks
[/code]
Sub PrintEng_00()
'Determines how many engineers there are on selected patch
Sheets("Sheet2").Select
If Range("NumberOfEng").Value = 1 Then PrintEng_01
If Range("NumberOfEng").Value = 2 Then PrintEng_02
If Range("NumberOfEng").Value = 3 Then PrintEng_03
If Range("NumberOfEng").Value = 4 Then PrintEng_04
If Range("NumberOfEng").Value = 5 Then PrintEng_05
If Range("NumberOfEng").Value = 6 Then PrintEng_06
If Range("NumberOfEng").Value = 7 Then PrintEng_07
If Range("NumberOfEng").Value = 8 Then PrintEng_08
If Range("NumberOfEng").Value = 9 Then PrintEng_09
If Range("NumberOfEng").Value = 10 Then PrintEng_10
If Range("NumberOfEng").Value = 11 Then PrintEng_11
Sheets("Sheet2").Select
Range("Eng_Choice").Select
ActiveCell.FormulaR1C1 = "1"
Range("A1").Select
End Sub
Sub PrintEng_01()
' 1 Engineer on the patch
Range("Eng_Choice").Select
ActiveCell.FormulaR1C1 = "1"
If Range("gross").Value >= 100 Then Sheets("Worse").Select
If Range("gross").Value <= 100 Then Sheets("Better").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Sheet2").Select
Range("A1").Select
End Sub
Sub PrintEng_02()
' 2 Engineer on the patch
PrintEng_01
Range("Eng_Choice").Select
ActiveCell.FormulaR1C1 = "2"
If Range("gross").Value >= 100 Then Sheets("Worse").Select
If Range("gross").Value <= 100 Then Sheets("Better").Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("Sheet2").Select
Range("A1").Select
End Sub
I hope that is clear enough
Thanks