View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_1246_] Simon Lloyd[_1246_] is offline
external usenet poster
 
Posts: 1
Default Excel UserForm textboxes and checkboxes???


This should do what you need:

Code:
--------------------
Private Sub CommandButton1_Click()
Dim cCont As Control
If MsgBox("Do you really want to cancel?", vbYesNo, "Cancel Action") = vbYes Then
For Each cCont In Me.Controls
If TypeName(cCont) = "CheckBox" Then
cCont.Value = False
End If
If TypeName(cCont) = "TextBox" Then
cCont.Value = ""
End If
Next cCont
End If
End Sub
--------------------



TotallyConfused;488536 Wrote:
I have a Userform with textboxes and checkboxes. I want to add a
"Cancel"
command button that when clicked on button it will ask if you want to
cancel
the form. If yes, clear all textboxes and checkboxes. If no, leave as
it
and continue. How do I write this code? Any help will be greatly
appreciated. Thank you.



--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=134692