Please give me a summary explanation of what each SUB in the code below does...Private Sub Worksheet_Activate()
Application.EnableEvents = False
ActiveSheet.Calculate
Application.EnableEvents = True
'If Not IsEmpty(ThisWorkbook.Sheets("Job Request").Range("B2")) Then 'check if B2 is not blank
Dim rng As Range
Set rng = ThisWorkbook.Sheets("Job Request").Range("A2:F2") 'set the range to check

If Application.WorksheetFunction.CountBlank(rng) = rng.Cells.Count Then 'check if all cells in the range are blank
Exit Sub 'exit the task if all cells are blank
End If

If Application.WorksheetFunction.CountBlank(rng) > 0 Then 'check if any cell in the range is blank
Dim answer As VbMsgBoxResult
answer = MsgBox("Do you want to delete the Request Entry", vbYesNo + vbQuestion, "Delete contents?")
If answer = vbYes Then
ThisWorkbook.Sheets("Job Request").Range("A2:F2").ClearContents
Application.EnableEvents = False
ActiveSheet.Calculate
Application.EnableEvents = True
End If
End If
End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
Const INSURANCE_REQUEST_MSG As String = "Contractor is not insured. Create INSURANCE Request?"
Const DBS_REQUEST_MSG As String = "Contractor has not been DBS’d. Create DBS Request?"
Const INSURANCE_DBS_REQUEST_MSG As String = "Contractor is not insured and has not been DBS’d. Create INSURANCE/DBS Request?"
Dim answer As VbMsgBoxResult
Dim insured As Boolean
Dim cleared As Boolean
Dim contractor As String

'CHECK AND MAKE SURE ONLY ONE CELL IS SELECTED
If Target.CountLarge > 1 Then Exit Sub
'CHECK IF CHANGE HAPPENED IN A2
If Not Intersect(Target, Range("A2")) Is Nothing Then
Application.EnableEvents = False
ActiveSheet.Calculate 'recalculate sheet
Application.EnableEvents = True

'IF CHANGE HAPPENED IN A2 THEN SHOW RELEVANT MESSAGE DEPENDING ON THE VALUES IN G3 AND H3
insured = (Range("G3").Value <> "")
cleared = (Range("H3").Value <> "")
contractor = Range("B3").Value
If Not insured And Not cleared Then
answer = MsgBox(Format(INSURANCE_DBS_REQUEST_MSG, contractor), vbYesNo + vbQuestion, "Send details")
If answer = vbYes Then
Call CopyToWorkPermit
Exit Sub
End If
ElseIf Not insured Then 'only G3 is empty
answer = MsgBox(Format(INSURANCE_REQUEST_MSG, contractor), vbYesNo + vbQuestion, "Send details")
If answer = vbYes Then
Call CopyToWorkPermit
Exit Sub
End If
ElseIf Not cleared Then 'only H3 is empty
answer = MsgBox(Format(DBS_REQUEST_MSG, contractor), vbYesNo + vbQuestion, "Send details")
If answer = vbYes Then
Call CopyToWorkPermit
Exit Sub
End If
End If

Complete Fields:
'both G3 and H3 have values
'IF ANSWER IS YES MOVE TO THE WORK PERMIT SHEET AND EXIT THE SUB
'IF ANSWER IS NO REMAIN IN CURRENT SHEET
'IF CHANGE HAPPENED IN F2 THEN CHECK IF ALL 6 CELLS IN A2:F2 HAVE VALUES
If Not Intersect(Target, Range("F2")) Is Nothing Then
If Application.CountA(Range("A2:F2")) = 6 Then
'WHEN ALL CELLS HAVE VALUES CALL THE REQUEST SUB
Call Request
ElseIf Application.CountA(Range("A2:F2")) <> 6 Then
'SHOW PROMPT "ALL FIELDS NEED TO BE FILLED IN
MsgBox ("All fields need to be filled in")
SelectFirstEmptyCell
End If
End If
End If
End Sub

Private Sub SelectFirstEmptyCell()
Dim ws As Worksheet
Dim LastCol As Long
Set ws = ActiveSheet
Application.EnableEvents = False
LastCol = ws.Cells(2, Columns.Count).End(xlToLeft).Column
ws.Cells(2, LastCol + 1).Select
Application.EnableEvents = True
End Sub

Sub Request()
Dim ws As Worksheet
Dim wss As Worksheet
Set ws = Worksheets("Job Request")
Set wss = Worksheets(Range("I2").Value)

wss.Select

Dim lastRow As Long
lastRow = wss.Cells(ws.Rows.Count, "B").End(xlUp).Row + 1
wss.Range("B" & lastRow).Value = ws.Range("B2").Value

wss.Range("C" & lastRow).Value = ws.Range("F2").Value

wss.Range("F" & lastRow).Value = ws.Range("C2").Value

wss.Range("J" & lastRow).Value = ws.Range("E2").Value

'wss.Select

'Call RequestText

'End Sub

'Sub RequestText()
'Dim ws As Worksheet
'Set ws = ActiveWorkbook.Worksheets("Job Request")
Dim filePath As String
Dim FileContents As String
filePath = "G:\Shared drives\Swan School Site Premises\PREMISES MANAGEMENT\SERVICE PROVIDERS\Request0.txt"
FileContents = ws.Range("A2").Value & vbCrLf & "" & vbCrLf & ws.Range("B2").Value & vbCrLf & "" & vbCrLf & ws.Range("C2").Value & vbCrLf & "" & vbCrLf & ws.Range("E2").Value & vbCrLf & "" & vbCrLf & ws.Range("F2").Value

Dim fileNumber As Integer
fileNumber = FreeFile()
Open filePath For Output As #fileNumber
Print #fileNumber, FileContents
Close #fileNumber

shell "notepad.exe " & filePath, vbNormalFocus

ws.Range("B2").ClearContents
ws.Range("F2").ClearContents
ws.Range("C2").ClearContents
ws.Range("E2").ClearContents
ws.Range("A2").ClearContents
ws.Range("E5:E20").ClearContents
End Sub

Sub Last_Ten_Jobs()

'Replace Sheet1 with the name of your Job Request sheet
'Replace Sheet2 with the name of your Request sheet
'Replace I2 with the cell reference containing the name of the sheet to be copied from

Dim sourceSheet As Worksheet
Dim destSheet As Worksheet
Dim lastRow As Long
Dim copyRange As Range

Set sourceSheet = Sheets(Range("I2").Value)
Set destSheet = Sheets("Job Request")

Application.ScreenUpdating = False

Application.EnableEvents = False
ActiveSheet.Calculate
'Do Until Application.CalculationState = xlDone
'DoEvents
'Loop
Application.EnableEvents = True

'Wait for 4 seconds
Application.Wait (Now + TimeValue("0:00:05"))

'Find the last non-empty row in the source sheet column J
lastRow = sourceSheet.Cells(Rows.Count, "J").End(xlUp).Row

'Set the range to be copied
If lastRow > 10 Then
Set copyRange = sourceSheet.Range("J" & lastRow - 9 & ":J" & lastRow)
Else
Set copyRange = sourceSheet.Range("J4:J" & lastRow)
End If

'Copy the range to the destination sheet column E
destSheet.Range("E5").Resize(copyRange.Rows.Count, 1).Value = copyRange.Value

'Restore the calculation mode to automatic
'Application.Calculation = xlCalculationAutomatic

Application.ScreenUpdating = True

End Sub

Sub CopyToWorkPermit()
Sheets("Work Permit").Select
Dim jobRequestSheet As Worksheet
Dim workPermitSheet As Worksheet
Dim lastRow As Long
Dim concatValues As String

'Assign the Job Request and Work Permit sheets to variables
Set jobRequestSheet = Worksheets("Job Request")
Set workPermitSheet = Worksheets("Work Permit")

'Check value of G3 and H3 of Job Request sheet
If jobRequestSheet.Range("G3").Value = "" And jobRequestSheet.Range("H3").Value = "" Then
'Both G3 and H3 are empty
concatValues = "Insurance & DBS details required"
ElseIf jobRequestSheet.Range("G3").Value = "" Then
'G3 is empty
concatValues = "Insurance details required"
ElseIf jobRequestSheet.Range("H3").Value = "" Then
'H3 is empty
concatValues = "DBS details required"
Else
'Both G3 and H3 have values
concatValues = ""
End If

'Get the next empty row in column A of Work Permit sheet
lastRow = workPermitSheet.Cells(Rows.Count, 1).End(xlUp).Row + 1

'Copy the concatenated values to column A of Work Permit sheet in the next empty row
workPermitSheet.Range("A" & lastRow).Value = concatValues

'Get the value of A2 from Job Request sheet
Dim contractor As String
contractor = jobRequestSheet.Range("A2").Value

'Enter the value of A2 to column B, today’s date to column C, and "Admin Request" to column D in the same row of Work Permit sheet
workPermitSheet.Range("B" & lastRow).Value = contractor
workPermitSheet.Range("C" & lastRow).Value = Date
workPermitSheet.Range("D" & lastRow).Value = "Admin Request"
End Sub


Private Sub Worksheet_Deactivate()
'Range("E5:E20").ClearContents
End Sub