Hello!
I'm new to VBA. How can I combine 2 worksheet change commands? I tried to do it as such below but only the first portion works.
Basically, what I want is that when user inputs "56765201 MEALS" or "56855753 ENTERTAINMENT EXPENSES" or "56855777 MEETINGS" under column D, a msgbox will pop up (the message would depend on the input.
And then in Column F, if the date they input is more than 90 days from current date, then a MsgBox should appear.
Hope somebody can help me out!
Code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim EmpNames$
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
If Target.Column <> 4 Then Exit Sub
If Target.Value = "56765201 MEALS" Then
MsgBox "Reminder that the allowed total daily reimbursable meals is P1,500.", vbOKOnly + vbInformation, "56765201 MEALS"
End If
If Target.Value = "56855753 ENTERTAINMENT EXPENSES" Then
MsgBox "The names, company names of your companions, and business reason MUST be provided.", vbOKOnly + vbExclamation, "56855753 ENTERTAINMENT EXPENSES"
Load FRMNames
FRMNames.Show
End If
If Target.Value = "56855777 MEETINGS" Then
MsgBox "Names of companion and business reason MUST be provided. The MOST SENIOR RANKING in the group is required to reimburse.", vbOKOnly + vbExclamation, "56855777 MEETINGS"
Load FRMNames
FRMNames.Show
End If
'************************** (1) Add >90 day prompt
'**************************New sheet value change command
Dim K As Date
Dim firstDate As Date, secDate As Date, n As Integer
If Target.Cells.Count > 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
If Target.Column <> 6 Then Exit Sub
K = Date
firstDate = DateValue(Target.Value)
secondDate = DateValue(K)
n = DateDiff("d", firstDate, secondDate)
If n > 90 Then
MsgBox n
End If
End Sub
Display More