View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
harpscardiff[_7_] harpscardiff[_7_] is offline
external usenet poster
 
Posts: 1
Default VBA Validation - textbox must not be blank


Hi, Thank for your reply.

I'm its not recognising the wend, even though there a while present?

here the code I coverted slightly:


Code
-------------------

Private Sub txtTTReason_Change() ' Listbox1 is the list of choices including "TT"

Me.txtTTReason.Value = "" ' assumes you need to erase the reason if you select anything else
If cboPaymentMethod.Value = "TT" Then
While Me.txtTTReason.Value = ""
' Get input, and also use Trim() to avoid user putting in only a space to get past prompt:
Me.txtTTReason.Value = Trim(InputBox("Please enter your reason(required):"))
If ActiveSheet.txtTTReason.Value = "" Then
txtTTReason.Value = MsgBox("You must enter a reason - blanks not allowed", vbExclamation, "INVALID REASON:") = vbOK
Wend

End If
End If


End Sub


Error i'm getting is compile error, Wend without Whil

--
harpscardif
-----------------------------------------------------------------------
harpscardiff's Profile: http://www.excelforum.com/member.php...fo&userid=2596
View this thread: http://www.excelforum.com/showthread.php?threadid=47878