![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: Ireland
Posts: 107
|
Just wondering is there a way you can set the contents of all text boxes to an empty string in a form when it is activated. Obviously you can do each individually but is there a way u can do it with a loop etc. Cheers.
__________________
[Brian] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sunny, spring-like Hull
Posts: 3,339
|
Try something like this: -
Private Sub UserForm_Initialize() Dim ctl As Control For Each ctl In Me.Controls If TypeName(ctl) = "TextBox" Then ctl.Text = "" Next ctl End Sub |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: Ireland
Posts: 107
|
Works perfect thanks for the quick reply.
__________________
[Brian] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|