Mandatory fields

Neilf01

New Member
Joined
Jul 8, 2011
Messages
8
I am wondering how/if i can make a field in excel (2007) a mandatory field so that a date has to be entered into it?
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
This is the basic formula:
Code:
=IF(AND(ISBLANK(H2),COUNTA(A2:G2)>0),1,0)
                ^            ^
                |            |
   This refers to the date   |
   of the first entry.       |
                             |
                This refers to all the other
                cells that can be filled in
                for the first entry.
As long as these references are correct, the formula should work.

As for your second error, here's a page about it: http://support.microsoft.com/kb/177828
 
Upvote 0
Hi Moonfish, it doesn't help that i am not great at anything on computers (apologies). The formula on the spreadsheet is great adn thats fine (as it tells me when the field is empty etc). The problem (i think) is with the macro as when i run the macro is states "compile error, methos or data member not found" I have inoput the macro code as below

Private Sub CommandButton1_Click()
If SaveAsUI = False Then
If Me.Worksheets("sheet1").Range("J2").Value > 0 Then
Cancel = True
MsgBox ("Save cancelled. Please fill in all the required fields and try again.")
End If
End If
End Sub

Does this look spot on to you or am i missing naything that should be on there. (the top line "private sub..., is already pre written by excel as are the final end if and end sub)
 
Upvote 0
You're not supposed to put it in a button, it's an automatic check.

It should prevent anyone from saving the file if the data is incomplete, but only if you use it exactly as I posted it earlier.
 
Upvote 0

Forum statistics

Threads
1,224,534
Messages
6,179,390
Members
452,909
Latest member
VickiS

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top