Setting Combo Box to display a blank

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box on a user form. I have set the Row source as =list!a1:a5.
However when I display the form the value displayed in the combo box is the
one from the previous record.

How do I get it to clear and show a blank each time?
 
Comboboxes remember their last settings. You have to initialize tthe box
before the .SHOW to change the settings.
 
Thanks. Could you help me with that please. I don't have the knowledge.
This is what I have so far:

Sub Button1_Click()

Range("B3").Value = Worksheets("table").Range("A20000").End(xlUp).Row
Range("C1").Value = ""
Range("D1").Value = 0
Range("E1").Value = Format(Date, "dd/MM/yy")

myform.Show
myform.fname.SetFocus


End Sub
 
myform.ComboBox1.ListIndex = -1
myform.Show


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
If you want to be able to select the same selection as previously selected then

Private Sub ListBox1_MouseDown(ByVal Button As _
Integer, ByVal Shift As Integer, ByVal X As Single, _
ByVal Y As Single)
Listbox1.Listindex = -1
End Sub

this won't visibly clear the selection if you are issuing a show command
after a hide. for that, you would need to issue the same command in the
useform_activate event I would suspect. or better yet, issue it just before
the show command

myform.ListBox1.ListIndex = -1
myform.Show
 

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