+ Reply to Thread
Results 1 to 3 of 3

Make a cell mandatory so that user can't navigate away from sheet until its populated

  1. #1
    Registered User
    Join Date
    02-27-2008
    Posts
    44

    Make a cell mandatory so that user can't navigate away from sheet until its populated

    Hi

    I want to make certain cells in a column mandatory based on the value of the cell in the previous column so that the user can't navigate away from the sheet until they have entered something into the mandatory cell.

    e.g. amount exceeds guidelines so they have to enter an explanation for the exception.

    Any ideas?

    Thanks

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229
    This routine, put in a sheet's code module, prevents the user from selecting a differnt sheet unless "good" is in A1. Changing the condition might meet your need.
    Please Login or Register  to view this content.
    Data validation is another, less aggressive, approach. If the user can't finish entering the bad value, they can't select a different sheet.
    Last edited by mikerickson; 02-27-2008 at 12:56 PM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Registered User
    Join Date
    02-27-2008
    Posts
    44

    Thanks....how do I apply it to a whole range of cells?

    This what I've got so far:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    With Worksheets("D - GOSCE - Protected Data")
    If .Range("AR6").Value = "TRUE" And .Range("AS6").Value = "" Then
    MsgBox "Mandatory cell not filled. Please add exception explanation before proceeding"
    Cancel = True
    End If
    End With
    End Sub

    So basically if the condition is TRUE it prevents them from saving the file. It's working on this one cell, but how do I amend the code to cover a whole range of cells (1731 to be precise!)

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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