clearing comboboxes on open doesn't work quite right

dhoffman

New Member
Joined
Apr 1, 2002
Messages
29
I have a combobox on a worksheet. Apparently the value displayed in a combobox when the workbook was last saved will reappear in the combobox when the workbook is again first opened. However, the list of values associated with the combobox is not saved and will be empty when the workbook is first opened. And the clear method will have no effect upon the combobox. SO why in the world doesn't the clear method also clear this value? According to Office help files the clear method clears all list items and and clears the text box. What's the deal here? Am I actually going to have to assign Null to the combobox's value property?
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Hey Dustin,

Why don't you give us half a clue and post the code? What are we, mindreaders?


Regards,
Dan.
 
Upvote 0
Look it's really pretty simple. I just want to know if the clear method of a combobox is supposed to clear the value property of the combobox even when the combox's list is empty. One help file I read said that it should, but another said something about the clear method failing if the control is bound to a value. There are no errors generated when I call the clear method on said combobox. The combobox I am using (ActiveX object I believe) does not have a boundvalue property. I'm an excellent programmer, gotta watch jeopardy at 7.
 
Upvote 0
it's not really necessary but here's a condensed version of some of my code.

Private Sub Workbook_Open()
sheet1.ComboBox1.Clear
Initialize_Everything_Else
End Sub

the call to the combobox's clear method does nothing at startup when the combobox's list is empty but the value property contains the same value property value present when last the workbook was saved.
 
Upvote 0
Hi

Just a line dk is a pal and an advance programmer hes offering to help you, look at his posts, he asking for the VBA so he can help i assure you nearly all VBA is utterly useless even if from confidential sheets the sheet data is critical.. not he VBA we all know the VBA.. it getting it to work thats the trick, dk is offering that help...

I assusre you bar a few odd heading and custon formula what else is in vba a load of jiggingabout to sort data..

You coe tells very little... worth a shot i feel, might get the nagging problem solved...
 
Upvote 0
Don't know if this is what your in need of but here goes...
In these cases I use the following code

sheet1.ComboBox1.text=""

May not be the correct way but it works for me.
-D
 
Upvote 0
On 2002-04-02 15:30, dhoffman wrote:
it's not really necessary but here's a condensed version of some of my code.

Private Sub Workbook_Open()
sheet1.ComboBox1.Clear
Initialize_Everything_Else
End Sub

the call to the combobox's clear method does nothing at startup when the combobox's list is empty but the value property contains the same value property value present when last the workbook was saved.

Hi Dhoffman....I think you just answered your
question when you said "the value property contains the same value property value present when last the workbook was saved"

So just clear this value upon opening eg

Sheet1.ComboBox1.Value = ""
 
Upvote 0
It's interesting that even though the matchrequired property of a combobox is set to true that a value may be present when the list is empty.
 
Upvote 0
On 2002-04-03 07:34, dhoffman wrote:
It's interesting that even though the matchrequired property of a combobox is set to true that a value may be present when the list is empty.

Yes your're right....you would thinks that
this would reset too ...?
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,238
Members
448,555
Latest member
RobertJones1986

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top