Results 1 to 6 of 6

Macro-Verify required fields before proceding with routine (save)

Threaded View

pjbassdc Macro-Verify required fields... 02-10-2012, 11:54 AM
royUK Re: Macro-Verify required... 02-10-2012, 12:05 PM
pjbassdc Re: Macro-Verify required... 02-10-2012, 01:00 PM
royUK Re: Macro-Verify required... 02-11-2012, 06:19 AM
pjbassdc Re: Macro-Verify required... 02-11-2012, 01:04 PM
pjbassdc Re: Macro-Verify required... 02-13-2012, 01:48 AM
  1. #1
    Forum Contributor
    Join Date
    05-12-2009
    Location
    Hendersonville, TN
    MS-Off Ver
    Excel 2010
    Posts
    113

    Question Macro-Verify required fields before proceding with routine (save)

    Greetings,

    I am trying to get a macro that will check and stop (alert) for required cell incompleteness before running the rest of my macros. I found a workbook before_save macro, but it isn't working for me. Listed in the macro are the cells that are required on my worksheet that need to have a value other than " ". I would like this macro to run first after activating the command button I have my other macros attached to.

    Option Explicit
    
    Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    With Sheets("FORM")
    If .Range("A32,A38,A42,B2:B9,B12:B15,B18:B21,B23,B24,B27:B30,C21").Value = "" Then
        MsgBox "MISSING DATA. FILL IN REQUIRED FIELDS AND PROCESS AGAIN."
        Cancel = True
        .Activate
        .Range("A32,A38,A42,B2:B9,B12:B15,B18:B21,B23,B24,B27:B30,C21").Select
    End If
    End With
    End Sub
    Another question is if I list the cells in a range ie B18:B21, and lets say B19 is missing, would it get overlooked if there was some value in the other parts of the range? I am looking for the macro to flag any cell listed that may be missing information.


    Here is where I order macro operations:

    Sub RunRoutine()
    
    Call Logsheet
    Call filesave
    Call Merge
    
    
    MsgBox ("Data has been processed successfully - Click OK to end this Tech Form session")
    Application.Quit
    
    End Sub
    Thank you for any assistance or advice you may be able to provide.


    Patrick
    Last edited by pjbassdc; 02-13-2012 at 01:50 AM.

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