View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Slick Willie Slick Willie is offline
external usenet poster
 
Posts: 11
Default Make a cell mandatory before sending

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.
"dmposey" wrote in message ...
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