Results 1 to 6 of 6

Disable Saving Until All Mandatory Fields are Populated - Cant get it to work!!!

Threaded View

  1. #1
    Registered User
    Join Date
    01-03-2014
    Location
    Calgary, Alberta
    MS-Off Ver
    Excel 2010
    Posts
    3

    Unhappy Disable Saving Until All Mandatory Fields are Populated - Cant get it to work!!!

    Hello everyone,

    I am trying to disable saving until all mandatory cells are populated.
    a) Tested ctrl+s and clicking on the save button without results.
    b) Created a Private Sub that's triggering the error "Compile error: Expected End Sub" and it's highlighting Sub MandatoryFields()

    No idea what's wrong, not sure if it's a contradicting code that's making this happen. Tried several fixes without success... Please help!


    Sub MandatoryFields()
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
      If Sheets("Termination Report").Range("J6").Value = "" Then
          MsgBox "LEASE TYPE (J6( must be entered"
          Cancel = True
          Exit Sub
       End If
      If Sheets("Termination Report").Range("J7").Value = "" Then
          MsgBox "CLIENT'S PROVINCE (J7) must be entered"
          Cancel = True
          Exit Sub
       End If
      If Sheets("Termination Report").Range("J15").Value = "" Then
          MsgBox "UNIT RETENTION DETAILS (J15) must be entered"
          Cancel = True
          Exit Sub
       End If
      If Sheets("Termination Report").Range("D18").Value = "" Then
          MsgBox "DISPOSAL TYPE (D18) must be entered"
          Cancel = True
          Exit Sub
       End If
      If Sheets("Termination Report").Range("J19").Value = "" Then
          MsgBox "BUYER'S PROVINCE (J19) must be entered"
          Cancel = True
          Exit Sub
       End If
      If Sheets("Termination Report").Range("D24").Value = "" Then
          MsgBox "EQUITY/LOSS INSTRUCTIONS (D24) must be entered"
          Cancel = True
          Exit Sub
       End If
      If Sheets("Termination Report").Range("E28").Value = "" Then
          MsgBox "TERMINATION VALUE (E28) must be entered"
          Cancel = True
          Exit Sub
       End If
    End Sub
    Thank you in advance for your help!
    Last edited by Grex; 02-27-2017 at 07:39 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Mandatory Fields and Closing/Saving Workbooks
    By JCRoessler14 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2016, 10:31 AM
  2. Make fields mandatory else pop up dialog box while saving
    By leopl9319 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-30-2016, 04:02 AM
  3. Mandatory field required message when user skips mandatory fields
    By Bharathi27 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-11-2013, 05:12 AM
  4. Mandatory Fields
    By i82 in forum Excel General
    Replies: 1
    Last Post: 09-13-2012, 05:13 AM
  5. Mandatory fields check before saving the file
    By sudheesh.e in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-20-2008, 12:11 AM
  6. Replies: 2
    Last Post: 02-27-2008, 01:17 PM
  7. Mandatory Fields
    By Libby in forum Excel General
    Replies: 0
    Last Post: 01-19-2005, 06:11 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1