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

Good Day Group,

Have a UserForm with abt 70 Text and ComboBoxes.
They are named TextBox1 etc but not in consecutive order. Is there a way
with a short code to clear the text
in these boxes to avoid using:

TextBox1 = "" etc. abt 70 times?

(The boxes are grouped in 5 Frames)

Thanks in advance.

Brgds

CG Rosén


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Clearing text in TextBoxes

How about a For Next Loop? You can loop thru the collection making sure it's
a textbox and clear it.

"CG Rosén" wrote:

Good Day Group,

Have a UserForm with abt 70 Text and ComboBoxes.
They are named TextBox1 etc but not in consecutive order. Is there a way
with a short code to clear the text
in these boxes to avoid using:

TextBox1 = "" etc. abt 70 times?

(The boxes are grouped in 5 Frames)

Thanks in advance.

Brgds

CG Rosén



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Clearing text in TextBoxes

On Thu, 18 Aug 2005 20:31:03 GMT, CG Rosén wrote...
Good Day Group,

Have a UserForm with abt 70 Text and ComboBoxes.
They are named TextBox1 etc but not in consecutive order. Is there a way
with a short code to clear the text
in these boxes to avoid using:

TextBox1 = "" etc. abt 70 times?

(The boxes are grouped in 5 Frames)

Thanks in advance.

Brgds

CG Rosén



For Each Ctl In Me.Controls
Select Case LCase(TypeName(Ctl))
Case "textbox"
Ctl.Value = vbNullString
End Select
Next
--
Met vriendelijke groeten / Mit freundlichen Grüßen / With kind
regards/Avec mes meilleures salutations
BBert

April 20, 1986
Celtics (135) - Bulls (131)
Larry Bird: "God disguised as Michael Jordan"
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Clearing text in TextBoxes

Dim ctl As Control
For Each ctl In Me.Controls
If TypeOf ctl Is msforms.TextBox Then
ctl.Text = ""
End If
Next ctl

--

HTH

RP
(remove nothere from the email address if mailing direct)


"CG Rosén" wrote in message
...
Good Day Group,

Have a UserForm with abt 70 Text and ComboBoxes.
They are named TextBox1 etc but not in consecutive order. Is there a way
with a short code to clear the text
in these boxes to avoid using:

TextBox1 = "" etc. abt 70 times?

(The boxes are grouped in 5 Frames)

Thanks in advance.

Brgds

CG Rosén




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
Text wrap problem when printing labels/textboxes chipshot Excel Discussion (Misc queries) 1 September 30th 05 10:21 PM
Default text in textboxes MissGenie Excel Discussion (Misc queries) 1 June 7th 05 01:22 PM
Text length and TextBoxes Ron_D[_2_] Excel Programming 4 December 28th 04 09:47 AM
intermittent problem with clearing textboxes on forms Renae[_2_] Excel Programming 0 October 7th 04 03:57 AM
Clearing TextBoxes needs 2 clicks Ken McLennan[_3_] Excel Programming 8 September 2nd 04 01:53 PM


All times are GMT +1. The time now is 02:27 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"