Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default how to have fields to be required

I have an excel sheet that has fields we need to enter, (i.e. zipcode, State,
City), and what I want to know is HOW do I have it "mandatory" to have those
fields filled? Meaning if someone only fills 1 out of the 3 fields, then
tries to save it, it should prompt something like, "Please fill all fields
before saving", or something like that?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default how to have fields to be required

You would need event code to cancel the save if all three cells were not filled.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI _
As Boolean, Cancel As Boolean)
If Application.CountA(Sheets("Sheet1").Range("A1:C1") ) < 3 Then
Cancel = True
MsgBox "Please fill required cells, save has been cancelled"
End If
End Sub

Note: if user disables macros the above won't run.


Gord Dibben MS Excel MVP

On Fri, 6 Jun 2008 08:43:02 -0700, Mandatory fields in Excel <Mandatory fields
in wrote:

I have an excel sheet that has fields we need to enter, (i.e. zipcode, State,
City), and what I want to know is HOW do I have it "mandatory" to have those
fields filled? Meaning if someone only fills 1 out of the 3 fields, then
tries to save it, it should prompt something like, "Please fill all fields
before saving", or something like that?


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
Required fields in Excel [email protected] New Users to Excel 5 November 4th 10 05:33 PM
How can I fill in the required fields on my spreadsheet? gemms Excel Discussion (Misc queries) 3 February 1st 06 02:45 AM
Required fields with comments Cathy Landry Excel Worksheet Functions 0 August 19th 05 06:18 PM
highlighting required fields maryann Excel Worksheet Functions 2 June 23rd 05 06:16 PM
Required fields Emily Excel Discussion (Misc queries) 1 June 23rd 05 12:59 AM


All times are GMT +1. The time now is 01:14 PM.

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

About Us

"It's about Microsoft Excel"