Make a cell mandatory before sending

G

Guest

I have an excel form that is used to complete and inspection and then sent to
a particular person. I have a macro that they use for the SendMail function.
They are suppose to complete the Name & Phone number field but this does not
always get done. I want to make these cells mandatory before they are
allowed to email the form. Can someone tell me where to get the code? I
know very little VB code so please try to be very specific.

Thank you,
dmposey
 
S

Slick Willie

Perhaps something like this:
If Cells(1,"A") = "" then
Response = msgbox("Please insert value in cell A1")
Else
SendMail code
End If
 
G

Guest

I'm sure this is very simple, but I'm having problems with this code. I told
you I was a beginner! The form that I have created has 4 mandatory cells
that need to be completed. For each cell that is omitted, I want to display
a msgbox. Ex: Cell A2 requires their name. If cell A2 is "" then msgbox
"Please enter your name before submitting" else SendMail. Cell A5 requires
Phone Number: If cell A5 is "" then msgbox "Please enter Phone Number before
submitting" else SendMail.

What am I doing wrong?

here is what I have coded to a button:

Sub Button1_Click()

dim cells

If cells(2, a) = "" Then
MsgBox ("Please insert value in cell A2")
Else

ActiveWorkbook.SendMail Recipients:=""
End If

End Sub
 
S

Slick Willie

Certain words cannot be used as variables because they have special
meaning to Excel. Cells is one of those words, you shouldn't have to
declare it as a variable.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top