K0st4din
Active Member
- Joined
- Feb 8, 2012
- Messages
- 488
- Office Version
- 2016
- 2013
- 2011
- 2010
- 2007
- Platform
- Windows
Hello, everyone,
please help you to complete this macro:
Everything in it works, but I don't know how to add something that forbids closing the workbook before the mentioned cells are filled in if they are empty.
Thank you in advance
please help you to complete this macro:
VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim sht As Worksheet
Set sht = Application.ThisWorkbook.Worksheets("ime slyjitel")
Application.ScreenUpdating = False
If sht.Range("D3") = "" Then
MsgBox "text, text, text, text, text, text, text, "
End
ElseIf sht.Range("C2") = "" Then
MsgBox "text, text, text, text, text, text, text, "
End
ElseIf sht.Range("D4") = "" Then
MsgBox "text, text, text, text, text, "
End
ElseIf sht.Range("G4") = "" Then
MsgBox "text, text, text, text, text, "
End
ElseIf sht.Range("B4") = "" Then
MsgBox "text, text, text, text, "
End
Else
End If
Application.ScreenUpdating = True
End Sub
Everything in it works, but I don't know how to add something that forbids closing the workbook before the mentioned cells are filled in if they are empty.
Thank you in advance