Find name of combo box

rosphite1

New Member
Joined
Feb 12, 2014
Messages
5
I've written some vb code to put a combo box on a worksheet

here it is

ActiveSheet.DropDowns.Add(390, 15, 47, 103.5).Select
With Selection
.ListFillRange = "$i$2:$i$" & s + 1
.LinkedCell = "$h$16"
.DropDownLines = s + 1
.Display3DShading = False
End With

This by itself works fine

But I want the vb code to wait until the user has selected a value from the Combo box before it executes the remaining code

so I've written this

x = 0
Do Until x > 0
If DropDowns.selectedindex = -1 Then
x = 0
Else
x = 1
End If
Loop

It does not work.
From 'googling' I've got some solutions that could deliver the "wait until a selection has been made"
But they all appear to reference the Combo Box name. For the life of me I can't seem to find, anywhere, how to find the name of the Combo Box?

Can anyone help with these problems:
(1) how do I find what the combo box is called?
(2) is there simple vb code that will pause until a selection has been made from the combo box

Apologies if these appear silly - I'm very (very) new to VB but have much programming experience

Thank you in advance

PS I'm using Excel 2007
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
It will be in the properties (top line) when you select the combobox in the VBA editor

The generic one will be ComboBox1, ComboBox2, etc
 
Upvote 0
Thank you Lee

I've found what you refer to (but)
You will see from the snip that the the ComboBox is automatically called "Drop Down 24"
2014-09-11_0957 - Judge101010's library
But if I run the Maco again the name becomes "Drop Down 25" (as in the screen snip)
2014-09-11_0959 - Judge101010's library

To create the "wait until user selects a date from the ComboBox" process in VB how would I modify (or replace) the code I've writter:i.e.

x = 0
Do Until x > 0
If DropDowns.selectedindex = -1 Then
x = 0
Else
x = 1
End If
Loop

Kind regards
 
Upvote 0

Forum statistics

Threads
1,214,529
Messages
6,120,070
Members
448,943
Latest member
sharmarick

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