Private Sub Worksheet_Change(ByVal Target As Range)
If Range("LoanInfoEntered") = "Y" Then LoanInfo
If Target.Cells.CountLarge = 1 And Not Intersect(Range("M33:M2032"), Target) Is Nothing Then
Application.EnableEvents = False
Dim NewVal As String, OldVal As String
NewVal = Target.Value
OldVal = Target.Value
If Len(OldVal) > 0 And OldVal <> NewVal Then
Target = NewVal
Target.Offset(1).Select
cmdPmtMade_Click
Else
Range("M31").End(xlDown).Offset(1, 0).Select
End If
Application.EnableEvents = True
End If
'=========================
Dim F11_Blank As String, F12_Blank As String
F11_Blank = Range("F11").Text
F12_Blank = Range("F12").Text
If Target.Address = "$F$11" Or Target.Address = "$F$12" Then
If F11_Blank = "" Or F12_Blank = "" Then
MsgBox " OOPS - Blank Field" & vbNewLine & vbNewLine & _
" COMPOUND PERIOD or" & vbNewLine & " PAYMENT FREQUENCY" & vbNewLine & " cannot be blank.", , " Loan Info. . ."
If Range("F11") = "" Then Range("F11") = "Monthly"
If Range("F12") = "" Then Range("F12") = "Monthly"
End If
End If
'=========================
VerifyOneTimePmt '*** Must be run just prior to editing PmtMade ***
'*********** Routines to address editing PmtMade ************
'--------- Restore blank Paym't. Date ---------
If Range("F6").Locked = True Then
Dim d As Range
Set d = Intersect(Target, Range("M33:M2033"))
If d Is Nothing Then Exit Sub
If d.Cells.Count > 1 Then Exit Sub
Application.EnableEvents = False
If d = "" Then Application.Undo
Application.EnableEvents = True
End If
'----- Highlights DueDate for last PmtMade -----
If Not Intersect(Target, Range("M33:M2032")) Is Nothing And Range("F6").Locked = True Then
If Range("TempCell") = "Editing" Then
sendkeys "{right}{left}"
Range("TempCell") = "Pmt_Made"
Else
'----- To Higlight DueDate -----
On Error Resume Next
Application.EnableEvents = False
Selection.Offset(0, 1).Select
Selection.Offset(0, -1).Select
Application.EnableEvents = True
'-------------------------------
End If
End If
'*****************************************************************
'========= update Distribution Date for nonPITI posts ==============
On Error Resume Next
Dim cell As Range
Dim rng As Range
' Check for entry made to column M
Set rng = Intersect(Target, Columns("M:M"))
' If not entry made in column M, exit
If rng Is Nothing Then Exit Sub
' Loop through new entries made in column M
For Each cell In rng
' Check month of date in column C
If (cell.Offset(0, -10) <> "") And (Month(cell.Offset(0, -10)) = 12) Then
' Call procedure
Call DistributePITI
End If
Next cell
'======================================================================
If Not Intersect(Target, Range("M:M")) Is Nothing And Target.CountLarge = 1 Then
Range("M31").End(xlDown).Offset(1, 0).Select
End If
If Not Intersect(Target, Range("K6:K7")) Is Nothing And Target.CountLarge = 1 Then
Application.ScreenUpdating = False
SetLookupDate
Range("F6").Select
Range("C2").Select
Application.ScreenUpdating = True
End If
GoodBye:
End Sub