Setting value of controls to ""

  • Thread starter Thread starter SOS
  • Start date Start date
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
 
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)
 
Melanie,

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

Seamu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top