I heart Excel
Board Regular
- Joined
- Feb 28, 2011
- Messages
- 66
Hello,
I was posted something earlier, which was very helpful, and was given a Macro that will bring up an error message if not all manadatory fields are filled out on a form I have -
Public LR As Long
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Application.WorksheetFunction.CountA(Sheet1.Cells(LR + 1, "A").Resize(1, 10)) <> 10 Then
MsgBox "Please fill in all Mandatory fields before Saving", vbOKOnly, "Info"
End If
End Sub
Private Sub Workbook_Open()
LR = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
End Sub
I have had a play around and tried to amend the above to fit into what I am doing.
As it stands I fill in the form, miss out some fields, and the message appears, but I am still able to save.
I need to stop people saving the form until all Mandatory fields are completed.
I need to allow them to either exit the form and not save, or fill out the mandatory fields and save!!
The end users are going to love me for doing this, but needs must!
Thanks
I was posted something earlier, which was very helpful, and was given a Macro that will bring up an error message if not all manadatory fields are filled out on a form I have -
Public LR As Long
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Application.WorksheetFunction.CountA(Sheet1.Cells(LR + 1, "A").Resize(1, 10)) <> 10 Then
MsgBox "Please fill in all Mandatory fields before Saving", vbOKOnly, "Info"
End If
End Sub
Private Sub Workbook_Open()
LR = Sheet1.Cells(Rows.Count, "A").End(xlUp).Row
End Sub
I have had a play around and tried to amend the above to fit into what I am doing.
As it stands I fill in the form, miss out some fields, and the message appears, but I am still able to save.
I need to stop people saving the form until all Mandatory fields are completed.
I need to allow them to either exit the form and not save, or fill out the mandatory fields and save!!
The end users are going to love me for doing this, but needs must!
Thanks