VBA Code:
Sub Prints()
'
Dim i As Long
Dim q As Integer
q = Range("WrongName").Value
If q = 0 Then
Sheet6.Visible = xlSheetVisible
For i = 1 To Range("PupilCount")
Sheet6.Copy after:=Worksheets(Worksheets.Count)
Range("D1").Value = i
ActiveSheet.Name = Range("B2")
If i = 1 Then
x = Application.Dialogs(xlDialogPrinterSetup).Show
If x = False Then
MsgBox "All printing has been cancelled"
Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True
Sheet6.Visible = xlSheetHidden
Exit Sub
End If
End If
ActiveWindow.SelectedSheets.PrintOut
Next i
Sheet6.Visible = xlSheetHidden
End If
If q = 1 Then
MsgBox "You have 1 entry for which the names do not match." & vbCrLf & _
"Please find these by filtering the 'Match?' column to FALSE on the Student Reference tab and then making the necessary " & _
"changes in either the NCalc Data or Calc Data tab", vbExclamation
Sheet3.Select
Range("D1").Select
Exit Sub
End If
If q > 1 Then
MsgBox "You have " & q & " entries for which the names do not match." & vbCrLf & _
"Please find these by filtering the 'Match?' column to FALSE on the Student Reference tab and then making the necessary " & _
"changes in either the NCalc Data or Calc Data tab (or both).", vbExclamation
Sheet3.Select
Range("D1").Select
End If
End Sub
Last edited by a moderator: