Mrjcharlton
New Member
- Joined
- Aug 3, 2020
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hello!
I am trying to use the below macro to flag an error message when a date range exceeds 7 days.
I have used the below which only applies to the first cell in the column. What must I do to apply it to the whole column, I have 350 rows.
Just to let you know column K is a calculation of days based on dates added to columns H & I.
Also, cell K492 has the value "7" in it.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("K2").Value > Range("K492").Value Then
MsgBox "Payroll Period can not be more than 7 days"
End If
End Sub
Thank you
I am trying to use the below macro to flag an error message when a date range exceeds 7 days.
I have used the below which only applies to the first cell in the column. What must I do to apply it to the whole column, I have 350 rows.
Just to let you know column K is a calculation of days based on dates added to columns H & I.
Also, cell K492 has the value "7" in it.
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("K2").Value > Range("K492").Value Then
MsgBox "Payroll Period can not be more than 7 days"
End If
End Sub
Thank you