
Originally Posted by
Fluff13
How about
Private Sub Workbook_BeforeSave(ByVal SaveasUI As Boolean, Cancel As Boolean)
Dim Cl As Range
Dim Flg As Boolean
For Each Cl In Range("B7", Range("B" & Rows.Count).End(xlUp))
If Not IsEmpty(Cl) Then
If Application.CountA(Cl.Offset(, 1).Resize(, 13)) <> 13 Then
Flg = True
MsgBox "Please fill in blank cells " & Cl.Offset(, 1).Resize(, 13).SpecialCells(xlBlanks).Address(0, 0)
End If
If Application.CountA(Cl.Offset(, 15).Resize(, 9)) = 0 Then
Flg = True
MsgBox ("Please Fill In a Division For Cells Between sDiv")
End If
If Application.CountA(Cl.Offset(, 23).Resize(, 3)) <> 3 Then
Flg = True
MsgBox "Please fill in blank cells " & Cl.Offset(, 23).Resize(, 3).SpecialCells(xlBlanks).Address(0, 0)
End If
End If
If Flg Then Cancel = True
Next Cl
Rows("7:119").EntireRow.AutoFit
End Sub
Fluff13 thank you so much your code worked I just altered it a bit since the offset was off by 1 cell for the divisions in range "p7:x7" and was still letting me save it if something wasn't marked in those ranges. Below is the altered code and works perfectly thank you again.
Private Sub Workbook_BeforeSave(ByVal SaveasUI As Boolean, Cancel As Boolean)
Dim Cl As Range
Dim Flg As Boolean
For Each Cl In Range("B7", Range("B" & Rows.Count).End(xlUp))
If Not IsEmpty(Cl) Then
If Application.CountA(Cl.Offset(, 1).Resize(, 13)) <> 13 Then
Flg = True
MsgBox "Please fill in blank cells " & Cl.Offset(, 1).Resize(, 13).SpecialCells(xlBlanks).Address(0, 0)
End If
If WorksheetFunction.CountA(Cl.Offset(, 14).Resize(, 9)) = 0 Then
MsgBox "Please Fill In a Division For Cells Between " & Cl.Offset(, 14).Resize(, 9).SpecialCells(xlBlanks).Address(0, 0)
Cancel = True
End If
If Application.CountA(Cl.Offset(, 23).Resize(, 3)) <> 3 Then
Flg = True
MsgBox "Please fill in blank cells " & Cl.Offset(, 23).Resize(, 3).SpecialCells(xlBlanks).Address(0, 0)
End If
End If
If Flg Then Cancel = True
Next Cl
Rows("7:119").EntireRow.AutoFit
End Sub
Bookmarks