Thread: Message boxes
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jock Jock is offline
external usenet poster
 
Posts: 440
Default Message boxes

Excellent job guys. How do I halt the code then until all boxes have been
populated and the command button is clicked once again by the user?
--
tia

Jock


"Mike H" wrote:

Jock,

This will loop through all tect boxes on a user form and generate a message
for each unpopulated one. Instead of the message you could cancel data
transfer to your worksheet.

Private Sub CommandButton1_Click()
Dim TB As Control
For Each TB In UserForm1.Controls
If TB.Name Like "TextBox*" Then
If TB.Value = "" Then
MsgBox (TB.Name & " isn't populated")
End If
End If
Next
End Sub


Mike
"Jock" wrote:

I have six text boxes on a user form. How can I make a message box pop up if
any of them haven't been populated when a command button is clicked to move
the data to the spreadsheet?
--
tia

Jock