I have an employee sign in sheet that after they click on the button to sign out, the cells in that row all lock so no one can edit their info after they sign.
I have 4 cells that I check to make sure that they fill in before signing. My macro works great and it's exactly what I need. However, since I have the button click separate for each employee, I need to duplicate the macro 40 times.
Is there any way I can change to following code using offset or anything else rather than re-writing it for line 11, 12, 13 etc. all the way to 50?
Application.DisplayAlerts = False
On Error Resume Next
If Application.CountA(Range("I10,J10,K10,L10")) <> 4 Then
If Range("V10").Value = "COM" And Range("I10").Value = "" Then
MsgBox "Please enter number of commercial lifts", vbExclamation, "Required Entry"
Range("I10").Select
Exit Sub
ElseIf Range("V10").Value = "COM" And Range("J10").Value = "" Then
MsgBox "Please enter number of commercial yards", vbExclamation, "Required Entry"
Range("J10").Select
Exit Sub
ElseIf Range("V10").Value = "RESI" And Range("K10").Value = "" Then
MsgBox "Please enter number of resi drive bys", vbExclamation, "Required Entry"
Range("K10").Select
Exit Sub
ElseIf Range("V10").Value = "RO" And Range("L10").Value = "" Then
MsgBox "Please enter number of Boxes that were Dumped today", vbExclamation, "Required Entry"
Range("L10").Select
Exit Sub
End If
End If
Any help would be greatly appreciated.
I have 4 cells that I check to make sure that they fill in before signing. My macro works great and it's exactly what I need. However, since I have the button click separate for each employee, I need to duplicate the macro 40 times.
Is there any way I can change to following code using offset or anything else rather than re-writing it for line 11, 12, 13 etc. all the way to 50?
Application.DisplayAlerts = False
On Error Resume Next
If Application.CountA(Range("I10,J10,K10,L10")) <> 4 Then
If Range("V10").Value = "COM" And Range("I10").Value = "" Then
MsgBox "Please enter number of commercial lifts", vbExclamation, "Required Entry"
Range("I10").Select
Exit Sub
ElseIf Range("V10").Value = "COM" And Range("J10").Value = "" Then
MsgBox "Please enter number of commercial yards", vbExclamation, "Required Entry"
Range("J10").Select
Exit Sub
ElseIf Range("V10").Value = "RESI" And Range("K10").Value = "" Then
MsgBox "Please enter number of resi drive bys", vbExclamation, "Required Entry"
Range("K10").Select
Exit Sub
ElseIf Range("V10").Value = "RO" And Range("L10").Value = "" Then
MsgBox "Please enter number of Boxes that were Dumped today", vbExclamation, "Required Entry"
Range("L10").Select
Exit Sub
End If
End If
Any help would be greatly appreciated.