Can anyone help me please the code i have got is attached below but the problem i am having is when i enter the letter "H" which is calculated in AJ and i enter it fast it comes up with the error "Out Of Stack Space error 28"
AJ in the code below is where the cumlative value is stored, and AI is the value that it is measured against it AJ is greater than AI the message is displayed
I am in need of urgent help and would appreciate some help, the project is for a charity and i have promised them they will have it before the end of the year, this is at no cost to them
Code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rRow As Range
Dim icolor As Integer
Dim ifont As Integer
With Application
.CellDragAndDrop = False
.CutCopyMode = False
End With
If Intersect(Target, Me.Range("TABLE1")) Is Nothing Then Exit Sub
Me.Calculate
For Each rRow In Target.Rows
If Me.Cells(rRow.Row, "AJ") > Me.Cells(rRow.Row, "AI") Then
rRow.ClearContents
MsgBox "No Holidays Left or No Holidays setup Against Them " & Me.Cells(rRow.Row, "AI") & " days."
End If
Next
If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub
On Error Resume Next
If Not Intersect(Target, Range("TABLE1")) Is Nothing Then
Application.EnableEvents = False
Target = UCase(Target)
Select Case Target
Case Is = "C"
icolor = 1 'Black
ifont = 2 'White
Case Is = "H"
icolor = 4 'Green
ifont = 1 'Black
Case Is = "AMH"
icolor = 4 'Green
ifont = 1 'Black
Case Is = "PMH"
icolor = 4 'Green
ifont = 1 'Black
Case Is = "S"
icolor = 3 'Red
ifont = 2 'White
Case Is = "AMS"
icolor = 3 'Red
ifont = 2 'White
Case Is = "PMS"
icolor = 3 'Red
ifont = 2 'White
Case Is = "T"
icolor = 5 'Blue
ifont = 2 'White
Case Is = "AMT"
icolor = 5 'Blue
ifont = 2 'White
Case Is = "PMT"
icolor = 34 'Pastel Blue
ifont = 2 'White
Case Is = "P"
icolor = 34 'Pastel Blue
ifont = 1 'White
Case Is = "UH"
icolor = 6 'Yellow
ifont = 1 'Black
Case Is = "PMUH"
icolor = 6 'Yellow
ifont = 1 'Black
Case Is = "AMUH"
icolor = 6 'Yellow
ifont = 1 'Black
Case Is = "M"
icolor = 40 'pink
ifont = 1 'Black
Case Is = "D"
icolor = 46 'orange
ifont = 1 'Black
Case Is = "AMD"
icolor = 46 'orange
ifont = 1 'Black
Case Is = "PMD"
icolor = 46 'orange
ifont = 1 'Black
Case Is = "DL"
icolor = 7 'purple
ifont = 1 'Black
Case Else
End Select
Target.Interior.ColorIndex = icolor
Target.Font.ColorIndex = ifont
Application.EnableEvents = True
On Error GoTo 0
End If
End Sub
Display More