This will work if you put the below code in the MS Visual Basic Editor.
It needs to go in the "This Workbook" object. This works if you ar
going across the book, aka A1:D1 (looks for Tardy in these). It wil
continue to run until it hits a blank spot on the row it's looking fo
"Tardy" on. If you need something different let me know...
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim r As Variant
Dim WSN As Variant
Set WSN = ThisWorkbook.Sheets("Sheet1") 'change to sheet to run on
r = 1 'change this to the value of the first cell to start the loop i
(if A2 then r = 2)
Do Until WSN.Cells(1, r).Value = ""
If WSN.Cells(1, r).Value = "Tardy" And WSN.Cells(2, r).Value = "
Then
MsgBox "Please enter the amount of time tardy."
Cancel = True
Exit Do
Exit Sub
Else:
r = r + 1
End If
Loop
End Su
--
dok11
-----------------------------------------------------------------------
dok112's Profile:
http://www.excelforum.com/member.php...fo&userid=1058
View this thread:
http://www.excelforum.com/showthread.php?threadid=51377