Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim ThisRow As Long
Dim dRng As Range
ThisRow = Target.Row
If Target.Column = 1 Then
If Target.Value <> "" Then
Range("B" & ThisRow).Formula = "=VLOOKUP(A" & ThisRow & ",'All Staff (Names)'!A:C,3,FALSE)"
Range("C" & ThisRow).Formula = "=VLOOKUP(A" & ThisRow & ",'All Staff (Names)'!A:C,2,FALSE)"
Range("E" & ThisRow).Formula = "=DATEDIF(VLOOKUP(A" & ThisRow & ",DETAILS!A:D,4,FALSE),""14/02/2014"",""Y"")"
Range("F" & ThisRow).Formula = "=DATEDIF(VLOOKUP(A" & ThisRow & ",Salary!A:D,4,FALSE),""14/02/2014"",""Y"")"
Range("G" & ThisRow).Formula = "=VLOOKUP(VLOOKUP(A" & ThisRow & ",DETAILS!A:I,8,FALSE),Division!B:C,2,FALSE)"
Range("H" & ThisRow).Formula = "=VLOOKUP(VLOOKUP(A" & ThisRow & ",DETAILS!A:I,9,FALSE),Department!B:C,2,FALSE)"
Range("I" & ThisRow).Formula = "=VLOOKUP(A" & ThisRow & ",DETAILS!A:G,7,FALSE)"
Range("J" & ThisRow).Formula = "=VLOOKUP(VLOOKUP(A" & ThisRow & ",DETAILS!A:E,5,FALSE),'All Staff (Names)'!A:D,4,FALSE)"
Range("R" & ThisRow).Formula = "=VLOOKUP(A" & ThisRow & ",'Active SUP'!A:J,10,FALSE)"
Range("S" & ThisRow).Formula = "=IF(AND(R" & ThisRow & "=""LGPS"",E" & ThisRow & ">=55),""Y"",""N"")"
Range("AA" & ThisRow).Formula = "=VLOOKUP(A" & ThisRow & ",Salary!A:C,2,FALSE)"
Range("AB" & ThisRow).Formula = "=VLOOKUP(A" & ThisRow & ",Salary!A:C,3,FALSE)"
'Range("AC" & ThisRow).Formula = "=VLOOKUP(A" & ThisRow & ",Salary!A:C,3,FALSE)"
Range("AD" & ThisRow).Formula = "=AA" & ThisRow & "*3"
Range("AE" & ThisRow).Formula = "=AA" & ThisRow & "*2"
Range("AF" & ThisRow).Formula = "=AC" & ThisRow & "+AD" & ThisRow & "+AE" & ThisRow
Range("AG" & ThisRow).Formula = "=IF(S" & ThisRow & "=""Y"",AF" & ThisRow & "-T" & ThisRow & ",""NO CAP COST"")"
Range("AH" & ThisRow).Formula = "=(AD" & ThisRow & "*22%)+AE" & ThisRow & "+AC" & ThisRow
Range("AI" & ThisRow).Formula = "=IF(S" & ThisRow & "=""Y"",AH" & ThisRow & "+T" & ThisRow & ",""NO CAP COST"")"
Range("AJ" & ThisRow).Formula = "=AB" & ThisRow & "*22%"
Range("AK" & ThisRow).Formula = "=AB" & ThisRow & "+AJ" & ThisRow & ""
Else
Rows(ThisRow).ClearContents
Exit Sub
End If
End If
End Sub
Bookmarks