Good day, I have two macros that are to run on one page. The first checks to ensure the required cells are filled in (RGACHECK), and the second (RGA_SEND) names/saves the file and emails to the appropriate individual.
What I am hoping to achieve is if the first macro determines the cells are filled out, then it executes the second macro. If the cells are not filled out, the msg box states what cell(s) are empty and the user cannot proceed to the second macro until everything is filled out.
Sub RGACHECK()
Dim i As Range, j As Range, x As Range, y As Range
Set i = Sheets("RGA FORM").Range("C7")
Set j = Sheets("RGA FORM").Range("c8")
Set x = Sheets("RGA FORM").Range("c9")
Set y = Sheets("RGA FORM").Range("G9")
Set k = Sheets("RGA FORM").Range("g10")
Set l = Sheets("RGA FORM").Range("d16")
If i.Value = "" Then
i.Select
GoTo cancelMe
End If
If j.Value = "" Then
j.Select
GoTo cancelMe
End If
If x.Value = "" Then
x.Select
GoTo cancelMe
End If
If y.Value = "" Then
y.Select
GoTo cancelMe
End If
If k.Value = "" Then
k.Select
GoTo cancelMe
End If
If l.Value = "" Then
l.Select
GoTo cancelMe
End If
Exit Sub
cancelMe:
MsgBox "Please fill in the ENTIRE FORM!" & ActiveCell.Address
Cancel = True 'cancels the save event
End Sub
The second macro...
Sub RGA_Send()
'Jason
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="2007jv2350"
Cells.CheckSpelling SpellLang:=1033
Dim fnb As String
fnb = "RGA #09-" & Range("G2").Value & " " & Range("C7").Value & " " & Range("C8").Value & ".xls"
ActiveWorkbook.SaveAs Filename:= _
"C:\Documents and Settings\Jim Stevenson\My Documents\RGA Requests\" & fnb
ActiveWorkbook.SendMail Array("safecracker@******.com", "jason@******.com")
ActiveWorkbook.Close SaveChanges:=True
ThisWorkbook.Close SaveChanges:=False
Application.ScreenUpdating = False
End Sub
Both of the above macros work fine on their own, I am hoping someone here could help me connect the two macros.
Thanks!
Bookmarks