Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 470
Default Clearing fields in Userform

Is there an easy way to clear all fields in a userform (textboxes and
comboboxes)?
I have about 26 fields of text or combo boxes and wanted to see if there is
just a command to "clear" userform.

Thanks,
Les
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Clearing fields in Userform

See if this works for you:

Sub test()

Dim ctl As MSForms.Control

For Each ctl In Form1.Controls
Select Case TypeName(ctl)
Case "TextBox"
MainForm.Controls(ctl.Name).Text = vbNullString
Case "CheckBox"
MainForm.Controls(ctl.Name).Value = False
Case "OptionButton"
MainForm.Controls(ctl.Name).Value = False
End Select
Next ctl

End Sub


RBS



"WLMPilot" wrote in message
...
Is there an easy way to clear all fields in a userform (textboxes and
comboboxes)?
I have about 26 fields of text or combo boxes and wanted to see if there
is
just a command to "clear" userform.

Thanks,
Les


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
Clearing fields when differnt function selected Xman Excel Worksheet Functions 0 April 9th 10 04:46 PM
Pivot table clearing phantom page fields Spreadsheet Solutions Excel Programming 3 March 30th 07 08:00 PM
Clearing associated dropdown fields TC Excel Worksheet Functions 2 March 31st 06 09:15 PM
clearing unlocked fields on a protected sheet Dick Minter[_2_] Excel Programming 6 July 1st 05 10:42 PM
Clearing a userform Ramthebuffs[_8_] Excel Programming 2 June 28th 05 08:28 PM


All times are GMT +1. The time now is 06:29 PM.

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"