Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Saj Saj is offline
external usenet poster
 
Posts: 3
Default clear the Form

How can clear or reset the form using a commandbutton
thanx
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default clear the Form

There isn't built-in way to clear a user forms controls back to
their default state. You would have to loop through the Controls
collection and reset the controls, or do each one individually.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Saj" wrote in message
...
How can clear or reset the form using a commandbutton
thanx



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default clear the Form

What do you mean by form - Userform with controls, or a worksheet made to
look like a paper form.

What do you want to clear. Be specific.

The basic approach would be to loop through the items containing entries and
clear them individually.

--
Regards,
Tom Ogilvy

"Saj" wrote in message
...
How can clear or reset the form using a commandbutton
thanx



  #4   Report Post  
Posted to microsoft.public.excel.programming
Saj Saj is offline
external usenet poster
 
Posts: 3
Default clear the Form

Clear the UserForm or reset to default
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default clear the Form

The following code will clear out the text boxes on a form. You
can adapt the code for other types of controls.

Private Sub CommandButton1_Click()
Dim C As MSForms.Control
For Each C In Me.Controls
If TypeOf C Is MSForms.TextBox Then
C.Text = ""
End If
Next C
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Saj" wrote in message
...
Clear the UserForm or reset to default





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default clear the Form

Unload it, then show it again.

Don't try to reshow it from its own event code - have the original calling
routine show it again.

--
Regards,
Tom Ogilvy

"Saj" wrote in message
...
Clear the UserForm or reset to default



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
How to clear all checkboxes on a form? Arlen Excel Worksheet Functions 2 May 6th 10 04:20 PM
How do I clear 'form' content from an unprotected cell without mac Casey M Excel Worksheet Functions 4 January 22nd 09 07:10 PM
CLear Data Entry Form Fields Tony Excel Discussion (Misc queries) 2 January 21st 09 11:57 PM
Clear a Checkbox in a a user form Cerberus Excel Discussion (Misc queries) 6 June 26th 08 10:41 PM
clear specific cells in a form vdmbqb Excel Discussion (Misc queries) 1 November 24th 07 08:07 PM


All times are GMT +1. The time now is 10:50 AM.

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

About Us

"It's about Microsoft Excel"