I found this topic, but i would like to do it a bit different.
http://www.mrexcel.com/forum/showthread.php?t=75707
I am creating a form for others to fill in. But they don't fill it completely.
So i want to force them to
What they need to do:
If they fill in Cell G31 or H31 they must also fill in cel F31, before it will save the document.
If they try to save the file without F31 filled, it should give a messagebox that
says: Fill in Volume.
I've got a bit, but it won't work...
http://www.mrexcel.com/forum/showthread.php?t=75707
I am creating a form for others to fill in. But they don't fill it completely.
So i want to force them to

What they need to do:
If they fill in Cell G31 or H31 they must also fill in cel F31, before it will save the document.
If they try to save the file without F31 filled, it should give a messagebox that
says: Fill in Volume.
I've got a bit, but it won't work...
Code:
Privatesub Workbook_BeforeSave(ByVal SaveAsUi As Boolean, Cancel As Boolean)
Dim msg As String
If Not Worksheets("Sheet1"). Range("G31").Value Like "##" then
msg = "Befor saving, fill in Volume."
Cancel = True
End If
If Not Worksheets("Sheet1").Range("H31").Value Like "##" Then
msg = msg & vbCrLf & "Before saving, fill in Volume."
Cancel = True
End If
If Cancel Then
MsgBox msg
End If
End Sub
Last edited: