+ Reply to Thread
Results 1 to 2 of 2

In Excel, how to make a field required so it's not left blank?

  1. #1
    linplex
    Guest

    In Excel, how to make a field required so it's not left blank?

    I've seen a lot of advise, however I need complete, step-by-step
    instructions. Thanks!

  2. #2
    Chip Pearson
    Guest

    Re: In Excel, how to make a field required so it's not left blank?

    I assume you want to ensure that a cell is filled out before the
    workbook is closed. Open the VBA Editor, display the Project
    Window (CTRL+R) and open the ThisWorkbook code module. There,
    paste the following code:


    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    If Worksheets("Sheet1").Range("A1").Value = "" Then
    MsgBox "You must fill in A1."
    Cancel = True
    End If
    End Sub


    Change the Sheet name and cell reference to meet your needs.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com



    "linplex" <[email protected]> wrote in message
    news:[email protected]...
    > I've seen a lot of advise, however I need complete,
    > step-by-step
    > instructions. 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