Setting value of controls to ""

S

SOS

Hi all,

I have a userform with several controls on it and I want to reset the
all to have no value in them. I found the code below by searching bu
when I change it from

ctl.visible=false

to ctl.value=""

it doesn't like it

Can anyone help, please?

TIA

Seamus

******************************************

Private Sub Test()
Dim ctl As Control

For Each ctl In Controls
ctl.Visible = False
Next ctl
End Su
 
M

Melanie Breden

I have a userform with several controls on it and I want to reset them
all to have no value in them. I found the code below by searching but
when I change it from

ctl.visible=false

to ctl.value=""

it doesn't like it

Can anyone help, please?

try this:

For Each ctl In Me.Controls
If TypeName(ctl) = "ComboBox" Then ctl.Value = ""
Next ctl

--
Mit freundlichen Grüssen

Melanie Breden
- Microsoft MVP für Excel -

http://excel.codebooks.de (Das Excel-VBA Codebook)
 
S

SOS

Melanie,

Many thanks - that works really well. I have now incorporated it int
my code and form

Seamu
 
Top