View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default Verify Userform complete before close

This might work.

For Each Textbox in Userform.Controls
(Statements)
Next


"Paul D." wrote:

I have a userform with several textboxes for data input. Before the form is
closed I would like to check that all textboxes contain data. If one or more
is blank, I would like to cancel the close and alert the user.

I suspect I need a statement in the QueryClose event and I was trying to use
something like this:

For Each Textbox in Userform
(Statements)
Next

This doesn't work "Object doesn't support this property or method". I
suppose I'm having difficulty understanding what a collection is. Whatever my
lack of understanding, any help to check a userform for blank textboxes
before closing the form?

Thanks
Paul