Sorry to reopen this, but I have found a slight glitch with the code I ended up using (below). I get a runtime error 13 type mismatch error if I try entering any data into the other columns of the table. How do I limit the range to columns D, E, F and G? In other words, I only want the code to execute if I am accessing cells in the range specified (rows 15 to 150) in columns D to G. Hope this is clear.
Thanks for any help. 
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, MaxCount, aFormula
' SINTEK: MaxCount As Long
Set rng = Range(Cells(16, Target.Column), Cells(150, Target.Column))
If Intersect(Target, rng) Is Nothing Then Exit Sub
If Len(Target.Value) <> 0 Then
aFormula = "=LOOKUP(2,1/(W6:W30=" & Cells(15, Target.Column).Address & ")/(X6:X30=" & Target.Address & "),Y6:Y30)"
' SINTEK: aFormula = "=INDEX(Y6:Y30,MATCH(" & Cells(15, Target.Column).Address & " & " & Target.Address & ",W6:W30&X6:X30),1)"
MaxCount = Evaluate(aFormula)
If Application.WorksheetFunction.CountIf(rng, Target.Value) > MaxCount Then
MsgBox "This subject is already full in this option block. Please choose something else."
With Application
.EnableEvents = False
.Undo
.EnableEvents = True
End With
End If
End If
End Sub
Bookmarks