Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default Mandatory Field in Excel 2002

How do you set up a cell to make it a mandatory field so that if anyone fails
to enter a data in a cell or leaves it blank upon closing the worksheet, it
would prompt the user to enter data as it is a mandatory field?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Mandatory Field in Excel 2002

One way:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Sheets("Sheet1").Range("A1").Value = "" Then
MsgBox "you must enter data in A1"
Cancel = True
Sheets("Sheet1").Select
Range("A1").Select
End If
End Sub


Mike
Mike

"Somewhere In Excel 2002" wrote:

How do you set up a cell to make it a mandatory field so that if anyone fails
to enter a data in a cell or leaves it blank upon closing the worksheet, it
would prompt the user to enter data as it is a mandatory field?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Mandatory Field in Excel 2002

I've never been a fan of putting stuff in the workbook_beforeclose event.

If I open the workbook in error (or just don't want to save my changes), are you
going to make me enter stuff into the workbook just so I can close it?

And if I have to enter stuff in the workbook, are you going to make me save the
workbook before I can close it? What happens if I open the workbook and destroy
18 worksheets that are very important. If I try to close it, are you going to
force me to save it this way?

Personally, I'd try to do something else.

I like to add a warning message in a cell based on a formula:
=if(somethingisok,"","Warning--xxx and yyy have to be done first!")
(formatted in big bold red letters)

Then I as a user can see the warning and still be able to close without
saving--or close and save and fix at a later time.

Somewhere In Excel 2002 wrote:

How do you set up a cell to make it a mandatory field so that if anyone fails
to enter a data in a cell or leaves it blank upon closing the worksheet, it
would prompt the user to enter data as it is a mandatory field?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mandatory field size within table Robert Excel Discussion (Misc queries) 5 August 31st 07 12:09 AM
mandatory field flow23 Excel Discussion (Misc queries) 5 December 8th 06 04:42 PM
How do I create a mandatory field in Excel RSP Excel Programming 1 November 22nd 06 03:07 AM
How do I create a mandatory field in Excel RSP Excel Programming 1 November 21st 06 06:55 PM
how do you set up a mandatory field in Excel? Lisa Excel Discussion (Misc queries) 2 November 30th 04 11:20 PM


All times are GMT +1. The time now is 12:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"