Required fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need some help making fields in Excel required. I'd like to make it so
that before someone can save a spreadsheet and/or e-mail it, all fields are
filled out. Note that these fields are text boxes and check boxes.

I'd appreciate suggestions. Thanks!
 
Are the text and check boxes on a user form or are they placed directly on a
worksheet?

A user form would give you a greater amount of control.
 
They are directly on a spreadsheet.

Brian

Kevin B said:
Are the text and check boxes on a user form or are they placed directly on a
worksheet?

A user form would give you a greater amount of control.
 
I created 3 objects in a spreadsheet, 2 text boxes named txt1 and txt2, and a
check box named chk1.

The following code in placed in the workbook’s On Open

If Me.chk1.Value = True And Len(Me.txt1) > 0 And Len(Me.txt2) > 0 Then
Application.CommandBars("Worksheet Menu Bar").Enabled = True
Else
Application.CommandBars("Worksheet Menu Bar").Enabled = False
End If

I then added the same code to the on Change event for the 2 text boxes and
the on click event for the check box

Not particularly elegant, but it does the job of disabling the menu until
the text boxes and check box have the correct values.

To turn off the formatting and standard toolbars, repeat the
Application.CommandBars statement changing the name from “Worksheet Menu Barâ€
to “Standard†and “Formatting†to toggle those off/on as well.
 
Additionally, you could protect the worksheet as well, for contents and
scenarios, but not objects, and then unprotect the worksheet when the
textboxes and checkboxes have been properly populated.
 
Thanks, I will try this.

Kevin B said:
I created 3 objects in a spreadsheet, 2 text boxes named txt1 and txt2, and a
check box named chk1.

The following code in placed in the workbook’s On Open

If Me.chk1.Value = True And Len(Me.txt1) > 0 And Len(Me.txt2) > 0 Then
Application.CommandBars("Worksheet Menu Bar").Enabled = True
Else
Application.CommandBars("Worksheet Menu Bar").Enabled = False
End If

I then added the same code to the on Change event for the 2 text boxes and
the on click event for the check box

Not particularly elegant, but it does the job of disabling the menu until
the text boxes and check box have the correct values.

To turn off the formatting and standard toolbars, repeat the
Application.CommandBars statement changing the name from “Worksheet Menu Barâ€
to “Standard†and “Formatting†to toggle those off/on as well.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top