Results 1 to 5 of 5

Mandatory Cell - If one cell contains information, then another must.

Threaded View

tfg1067 Mandatory Cell - If one cell... 11-14-2012, 06:20 PM
p24leclerc Re: Mandatory Cell - If one... 11-14-2012, 10:23 PM
tfg1067 Re: Mandatory Cell - If one... 11-17-2012, 03:43 AM
p24leclerc Re: Mandatory Cell - If one... 11-17-2012, 10:19 AM
tfg1067 Re: Mandatory Cell - If one... 11-19-2012, 02:10 AM
  1. #1
    Registered User
    Join Date
    11-13-2012
    Location
    CA, USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Mandatory Cell - If one cell contains information, then another must.

    Hi, I've been using this code to make sure a document cannot be saved without the required information being filled in, but I wondered if there is a way to make it a little smarter.

    It would be best if it was something like "If C4 contains information, then C5, B6 must". It would be good if a window popped up as well, stating that the related cells need to have information entered. I've searched the forum, but I haven't found anything directly related this this yet. Any input would be appreciated!

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Cellcontents = Sheets(1).Range("B3").Value
    If Cellcontents = "" Then
        Cancel = True
        MsgBox "Cell B3 is empty - Not Saving!", vbOKOnly, "Check Cells"
        Exit Sub
    End If
    
    Cellcontents = Sheets(1).Range("B4").Value
    If Cellcontents = "" Then
        Cancel = True
        MsgBox "Cell B4 is empty - Not Saving!", vbOKOnly, "Check Cells"
        Exit Sub
    End If
    
    Cellcontents = Sheets(1).Range("B6").Value
    If Cellcontents = "" Then
        Cancel = True
        MsgBox "Cell B6 is empty - Not Saving!", vbOKOnly, "Check Cells"
        Exit Sub
    End If
    
    
    End Sub
    Last edited by tfg1067; 11-14-2012 at 07:01 PM.

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