Results 1 to 5 of 5

Need code to make completion of certain cells mandatory before saving file

Threaded View

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    Sligo, Ireland
    MS-Off Ver
    Excel 2010
    Posts
    3

    Need code to make completion of certain cells mandatory before saving file

    Hello, Thanks in advance for reading this and any help provided. I'm new to VBA so any help is appreciated!

    I need to make a form unable to be saved before all the required cells are filled in. It's for work and we've a problem with people sending in request missing required information.

    The required cells are: F10,G10,F11,F14,F15,F19,F20,F21,F22,F23,F24,F25,F26,F28,I28,F32,F35,F37,F40,F41,F42,F44,F45,I45,F46,F47

    Some of these are merged cells, would that make a difference to the code required? e.g. G10 is a merged cell made up of G10,H10 & I10.
    A number of cells contain drop down menus (F10,F24,F25,F42,F44,F45,I45,F46,F47) so would that matter?

    I have the code that works for cell G10 but don't know how to edit it properly to make it so all the other required cells are also checked. The sheet in question is called CCL.

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
      If IsEmpty(Sheets("CCL").Range("G10")) Then
        Sheets("CCL").Activate
        Range("G10").Select
        MsgBox "Fill in Employee Name before saving."
        Cancel = True
      End If
    End Sub
    Attached Files Attached Files

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