View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Bunter_22@hotmail.com is offline
external usenet poster
 
Posts: 37
Default emailing worksheet

Hi Oreg,

The reason that your message box's do not work is that you don't use
response what you would use is say "if msgbox("...") = vbno then" etc.

What I have done is rewritten the first few lines of your code to
incorperate the msgbox problem and then the whole column porblem as
below:

Private Sub CommandButton2_Click()
Dim ErrorExists As Boolean
Range("H1").Select
Do Until ActiveCell.Value = ""
If ActiveCell.Value = "ERROR" Then
ErrorExists = True
End If
ActiveCell.Offset(1, 0).Select
Loop
If ErrorExists = True Then
If MsgBox("Errors still exist. Are you sure you want to mail
out?", _
vbYesNo) = vbNo Then End
End if
End if
'All of the rest of your code.

What this should do is run through column H beginning at H1 until it
hits a cell that has no information in it. If it finds any errors it
displays your message box requesting if the user wants to end. If they
don't it then runs through the rest of your code.

Any problems with it then give me a shout.

James