Originally Posted by
MATRIXOFFICE
Bump## anymore t houghts on this Rick?
Sorry about my absence. See if this code will do what you want...
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Mnths As Long, Rws As Long, FilledCellCount As Long, WS As Worksheet
For Mnths = 1 To 12
Set WS = Worksheets(UCase(Format(28 * Mnths, "mmm")))
For Rws = 5 To 150
If Len(WS.Cells(Rws, "G").Value) Then
FilledCellCount = WorksheetFunction.CountA(WS.Cells(Rws, "M").Resize(, 3))
If FilledCellCount <> 3 Then
Cancel = True
MsgBox "Please check Row #" & Rws & " on sheet """ & WS.Name & """" & _
vbLf & vbLf & "You have an incident filled in Column G for that row " & _
"but you are missing one or more pieces of data in Columns M thru O"
WS.Activate
Cells(Rws, "M").Resize(, 3).Select
Exit Sub
End If
End If
Next
Next
End Sub
Bookmarks