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
Bookmarks