Hello experts! 
I need some expert advice here please.... 
I have a SaveAsPDF module created that when run, it needs to convert the worksheet into excel. But before doing that, I need another module to run first, that is to check whether certain required fields are filled or not before it converts to .pdf. Pasted are my codes for both modules. I tried calling the Checkcells module but I keep on receiving "Compile error: Argument not optional" message. Or is there a way to incorporate my codes in one module that does both functions?
Please have time to assist. Thanks a lot in advance!
Sub SaveAsPDF()
Call Checkcells.emptycell
Dim fname As String
Dim wb As Workbook
Dim newfilename As String
Dim newfilefilter As String
Dim mytitle As String
Set wb = ThisWorkbook
Cells.Interior.ColorIndex = 0
newfilename = "Shift Handover" & "_" & wb.Sheets("Shift Handover_D2").Range("E8").Value & "_" & wb.Sheets("Shift Handover_D2").Range("E9") & ".pdf"
newfilefilter = "PDF files (*.pdf), *.pdf"
mytitle = "Navigate to the required folder"
fname = Application.GetSaveAsFilename(InitialFileName:=newfilename, Filefilter:="PDF files (*.pdf), *.pdf")
If fname <> "False" Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=newfilename, OpenAfterPublish:=True
Else
MsgBox ("File NOT converted. Make sure to convert before exit."), vbExclamation
End If
End Sub
Public Sub emptycell(cancel As Boolean)
Dim ws As Worksheet
Set ws = Sheets("Shift Handover_D2")
If ws.Range("c4") = Empty Then
ws.Range("c4").Interior.ColorIndex = 38
MsgBox ("Please enter Station Name")
cancel = True
Else
ws.Range("c4").Select
ws.Range("c4").Interior.ColorIndex = 0
End If
If ws.Range("e7") = Empty Then
ws.Range("e7").Interior.ColorIndex = 38
MsgBox ("Please enter Outgoing shift schedule.")
cancel = True
Else
ws.Range("e7").Interior.ColorIndex = 0
End If
If ws.Range("i7") = Empty Then
ws.Range("i7").Interior.ColorIndex = 38
MsgBox ("Please enter Incoming shift schedule.")
cancel = True
Else
ws.Range("i7").Interior.ColorIndex = 0
End If
If ws.Range("f19") = Empty Then
ws.Range("f19").Interior.ColorIndex = 38
MsgBox ("Please enter Next Access Number.")
cancel = True
Else
ws.Range("f19").Interior.ColorIndex = 0
End If
End Sub
Thanks again in advance!
Bookmarks