View Single Post
  #5   Report Post  
Jeff Owen Jeff Owen is offline
Junior Member
 
Posts: 7
Default

Quote:
try:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim LCol As Long

With Sheets("Sheet1")
'Search for the last used column in row 5
LCol = .Cells(5, Columns.Count).End(xlToLeft).Column
'If the cell in row9 in the last used column is empty
'Saving is cancelled
If Len(.Cells(9, LCol)) = 0 And LCol 1 Then
MsgBox "Cannot save until ALL cells have been completed!"
Cancel = True
End If
End With
End Sub
Unfortunatley not. Ihave tweaked your earlier formula though.


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

With Sheets("Sheet1")
If WorksheetFunction.CountA(.Range("B9:F9")) < 5 And WorksheetFunction.CountA(.Range("B9:F9")) 1 Then
MsgBox "Cannot save until ALL cells have been completed!"
Cancel = True
End If
End With
End sub



how would I apply this to all the active sheets?
again massive thanks for your help!