Anandpersad
New Member
- Joined
- Oct 18, 2014
- Messages
- 31
Hi All,
I have the following VBA, which prevent the user from saving the file without filling in the mandatory fields.
The problem is, even I as creator of the VBA cannot save the file without entering data in those cells.
Can you help me with a VBA to avoid this.
So, the user of the file should always fill in the mandatory field before he/she can save the file, but the creator of the file can save without filling in the mandatory file.
I was thinking of a password protection. Only those who has the password can save without filling in he mandatory fields.
But I am also open for any other solution.
My VBA is as follows:
<tbody>
</tbody>
Thanks
Anandpersad
I have the following VBA, which prevent the user from saving the file without filling in the mandatory fields.
The problem is, even I as creator of the VBA cannot save the file without entering data in those cells.
Can you help me with a VBA to avoid this.
So, the user of the file should always fill in the mandatory field before he/she can save the file, but the creator of the file can save without filling in the mandatory file.
I was thinking of a password protection. Only those who has the password can save without filling in he mandatory fields.
But I am also open for any other solution.
My VBA is as follows:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) |
'Disables saving unless user fills in required cells |
Dim CheckC As Range |
Set CheckC = Range("H9") |
If CheckC.Value = "" Then |
MsgBox "Cell H9 Check", vbCritical, "Incomplete Entry" |
CheckC.Select |
Cancel = True |
End If |
Set CheckC = Range("H10") |
If CheckC.Value = "" Then |
MsgBox "Cell H10 check", vbCritical, "Incomplete Entry" |
CheckC.Select |
Cancel = True |
End If End Sub |
<tbody>
</tbody>
Thanks
Anandpersad