Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Visual Basic Form

Can anyone tell me how to clear a form? When I first pull my form up, which
has radio buttons with code, the buttons are clear but after I make a choice
and pull it up again button is still indicated. I have to close the form and
re-open it once again to clear. What am I not doing correctly?

Thx

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200801/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Visual Basic Form

Do you hide the userform and then show it?

If yes, try unloading and then loading it.



"Carrie_Loos via OfficeKB.com" wrote:

Can anyone tell me how to clear a form? When I first pull my form up, which
has radio buttons with code, the buttons are clear but after I make a choice
and pull it up again button is still indicated. I have to close the form and
re-open it once again to clear. What am I not doing correctly?

Thx

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200801/1


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Visual Basic Form

Try this: should work for both textbox & optionbutton

Private Sub CommandButton1_Click()
' Clear the form
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.TextBox Then
ctrl.Value = ""
ElseIf TypeOf ctrl Is MSForms.OptionButton Then
ctrl.Value = False
End If
Next ctrl
End Sub

"Carrie_Loos via OfficeKB.com" wrote:

Can anyone tell me how to clear a form? When I first pull my form up, which
has radio buttons with code, the buttons are clear but after I make a choice
and pull it up again button is still indicated. I have to close the form and
re-open it once again to clear. What am I not doing correctly?

Thx

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200801/1


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Visual Basic Form

This works well - Thanks

Alpineman2 wrote:
Try this: should work for both textbox & optionbutton

Private Sub CommandButton1_Click()
' Clear the form
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is MSForms.TextBox Then
ctrl.Value = ""
ElseIf TypeOf ctrl Is MSForms.OptionButton Then
ctrl.Value = False
End If
Next ctrl
End Sub

Can anyone tell me how to clear a form? When I first pull my form up, which
has radio buttons with code, the buttons are clear but after I make a choice
and pull it up again button is still indicated. I have to close the form and
re-open it once again to clear. What am I not doing correctly?

Thx


--
Message posted via http://www.officekb.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Visual basic, form does not show date correctly.... Haris Excel Worksheet Functions 6 November 7th 07 02:42 PM
visual basic user form date format dd/mm/yy not mm/dd/yy DarrenO Excel Discussion (Misc queries) 1 March 28th 07 01:56 AM
Inserting Form form Visual Basic... thomas Excel Programming 3 July 25th 05 10:01 PM
Make a visual basic form fill a page HFB Excel Programming 2 January 23rd 05 09:15 PM
Using Visual Basic form to enter data Stephen Carpineta \(Matco Electric\) Excel Programming 1 September 29th 03 08:20 PM


All times are GMT +1. The time now is 01:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"