Another issue with Required Cells in Excel 2010

Compslord

New Member
Joined
Jun 29, 2015
Messages
3
I have a workbook with multiple sheets. The end user in my office will only be using one at a time but that sheet needs to be completely filled in. They then save and email the sheet to me. I have read multiple peoples VBA codes to get that to work but everytime I try to save the form it doesn't give me an error or doesn't except the code. For now I need cells B5 B6 B8 B9 B10 B11 D6 F5 F6 F7 F8 F11 filled in on sheet named 'Domestic' .

I am very new to the world of VBA and need fairly explicit instructions. Sorry for the mulitple posts on this topic but I am having difficulty learning VBA.
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
this is the code I have, it works but I have multiple sheets and only one is used at a time. So what happens now is that no matter which sheet I am working on I get the error since sheet 1 isn't filled in.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Cells(5, 2).Value = "" Then

MsgBox "Patient Name Missing"

Cancel = True

End If
If Cells(5, 6).Value = "" Then

MsgBox "Patient Account Number Missing"

Cancel = True

End If
If Cells(6, 2).Value = "" Then

MsgBox "Date Patient Arriving Missing"

Cancel = True

End If
If Cells(6, 4).Value = "" Then

MsgBox "Date Patient Leaving Missing"

Cancel = True

End If
If Cells(6, 6).Value = "" Then

MsgBox "Person Placing Order Missing"

Cancel = True

End If
If Cells(8, 2).Value = "" Then

MsgBox "Name of Recipient Missing"

Cancel = True

End If
If Cells(8, 6).Value = "" Then

MsgBox "Delivery Date Requested Missing"

Cancel = True

End If
If Cells(7, 6).Value = "" Then

MsgBox "Receiver Phone Numer Missing"

Cancel = True

End If
If Cells(9, 2).Value = "" Then

MsgBox "Delivery Address Missing"

Cancel = True

End If
If Cells(10, 2).Value = "" Then

MsgBox "City, State, Zip Missing"

Cancel = True

End If
If Cells(11, 2).Value = "" Then

MsgBox "Patient Cell Number Missing"

Cancel = True

End If
If Cells(11, 6).Value = "" Then

MsgBox "Patient Team Number Missing"

Cancel = True

End If
If Cells(32, 2).Value = "" Then

MsgBox "RN NAME Missing"

Cancel = True

End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top