Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
sot sot is offline
external usenet poster
 
Posts: 19
Default Setting Combo Box to display a blank

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?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Setting Combo Box to display a blank

Comboboxes remember their last settings. You have to initialize tthe box
before the .SHOW to change the settings.

"sot" wrote:

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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
sot sot is offline
external usenet poster
 
Posts: 19
Default Setting Combo Box to display a blank

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

"Joel" wrote:

Comboboxes remember their last settings. You have to initialize tthe box
before the .SHOW to change the settings.

"sot" wrote:

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?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Setting Combo Box to display a blank

myform.ComboBox1.ListIndex = -1
myform.Show


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"sot" wrote in message
...
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

"Joel" wrote:

Comboboxes remember their last settings. You have to initialize tthe box
before the .SHOW to change the settings.

"sot" wrote:

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?




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Setting Combo Box to display a blank

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

--
Regards,
Tom Ogilvy

"sot" wrote:

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

"Joel" wrote:

Comboboxes remember their last settings. You have to initialize tthe box
before the .SHOW to change the settings.

"sot" wrote:

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?


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
Average Formula to display blank cell if named range is blank Rachael F Excel Worksheet Functions 3 February 22nd 08 05:05 PM
Setting default value for combo box Barb Reinhardt Excel Programming 1 November 6th 06 09:10 PM
how to get excel to display blank if reference cell blank silent1(not) Excel Worksheet Functions 1 December 2nd 05 02:49 PM
setting up drop down combo box with VBA windsurferLA Excel Programming 4 May 5th 05 11:10 PM
Setting the value of a cell from a combo box Nigel BEnnett Excel Programming 1 June 1st 04 07:36 PM


All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"