Combo box in Visual Basics

Hello Everyone,

I'm fairly new with Visual Basics.

I'm creating a form and I'd like to add a combo box (drop down Lisyt), and I 
can't seem to figure out how to validate the list from there.

Does anyone know how or have a reference to this?

Thank you in advance.
0
tamato43 (40)
3/28/2005 8:21:03 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
331 Views

Similar Articles

[PageSpeed] 59

Next time you're in the VBE working on your userform, click on the combobox and
hit F4 (to show its properties).

Then change the style to fmStyleDropDownList--this allows only the items in the
combobox's list.

Then you can use the .rowsource property to point at the range that should be
used for validation.

If you like you can do this in code, too:

Option Explicit
Private Sub UserForm_Initialize()

    Me.ComboBox1.Style = fmStyleDropDownList
    
    With Worksheets("sheet1")
        Me.ComboBox1.RowSource = .Range("a2", _
            .Cells(.Rows.Count, "A").End(xlUp)).Address(external:=True)
    End With
    
End Sub

There are other ways that can be used to populate the combobox, too--if you're
doing something special.

Debra Dalgleish has a list of books at her site:
http://www.contextures.com/xlbooks.html

John Walkenbach's is a nice one to start with.  I think that John Green (and
others) is nice, too (for a second book??).  See if you can find them in your
local bookstore and you can choose what one you like best.

tamato43 wrote:
> 
> Hello Everyone,
> 
> I'm fairly new with Visual Basics.
> 
> I'm creating a form and I'd like to add a combo box (drop down Lisyt), and I
> can't seem to figure out how to validate the list from there.
> 
> Does anyone know how or have a reference to this?
> 
> Thank you in advance.

-- 

Dave Peterson
0
ec357201 (5290)
3/29/2005 12:26:13 AM
Reply:

Similar Artilces:

How do you get the maximum value to display in text box form
In a form, if I have 4 text boxes and 3 of them will contain a number. How do you get the maximum value to display in the 4th. I have tried many different things, I can make it work for a single field in a table, but that finds the value through all records. I just want it to display the max value from the numbers on the form, which could be different for various records. You could use something like this as the Control Source of the 4th text box (the underscore is for ease of reading here, and must be removed from the Control Source): =IIf([Field1]>[Field2] And [Field1]>[Field3],...

Drop-Down box
I have been asked to create a drop-down box in Excel with pre-populated names. I really do not know how to get started with this. If anyone could help that would be great! Thank you! Adam You can use Data>Validation. There are instructions in Excel's help files, and here: http://www.contextures.com/xlDataVal01.html Adam wrote: > I have been asked to create a drop-down box in Excel with > pre-populated names. I really do not know how to get > started with this. If anyone could help that would be > great! -- Debra Dalgleish Excel FAQ, Tips & Book List ...

Enter Network Password dialog box
Since we upgraded to Office 2000, I receive the "Enter Network Password" dialog box every time email is received. The server, user name, and password are all filled in. I have the option to OK or Cancel. Selecting either will close the dialog box and bring up the Microsoft Outlook new mail has arrived notification. How can I get the "Enter Network Password" dialog box to go away? If numerous emails come in, the dialog box pops up for each one. Chris Bauer ...

inverting text box or fonts for artwork
I cannot figure out how to invert text that is inside a text box. If there is not any way to do this is there a way to invert text outside a text box? Thank you for your help Kathy The entire text box gets inverted. If you want just a line or a word to invert, you need to make a separate text box. Just make the box active, select the icon that looks like a line with an arrow head in a circle and click on it. BTW, this is with Publisher 2000. -- Don Vancouver, USA, a great city in one of the 45+ countries in America! "Kathy Keating" <revskc@mcdeb.com> wrote in message n...

Shrinking font in Report Text Box
I have strings of varying length that I need to display in the same text box, so I would like to be able to shrink the text if it would otherwise be truncated. I've read other, similar posts but still have a question. It seems that Lebans AutoSizeFont is the right module for me to download (http://www.lebans.com/autosizefont.htm), but having done that, I'm not sure how to "apply" it to the text box in question. I've got no experience using modules. Could someone walk me through it? Thanks, Keith Keith wrote: >I have strings of varying length that I need to...

Automatic Comments Boxes
I have a spreadsheet with two tabs that I use for work, One tab is inbound quantities and the other tab is the order no of that quantity. What I would like to do is where the quantity in a cell in inbound ie D8 is greater than 0 then a comment is automatically inserted quoting the value in D8 in the other tab. If this is possible it would be a great help. TIA Assuming inbound quantities are in Sheet1, Put in D8 in the other tab / sheet (for order no.) : =IF(AND(ISNUMBER(Sheet1!D8),Sheet1!D8>0),Sheet1!D8,"") -- Rgds Max xl 97 --- Please respond in thread xdemechanik <at...

Problem displaying string data in Edit box
Hi, I am trying to display a CString in an Editbox. In the dialog, I have set the edit box to multiline, read-only, auto vertical scroll and want return. I set the Edit box with the CString variable when a serial handler occurs. The serial handler code is obtained from http://www.codeproject.com/KB/system/serial.aspx and have integrated into my main dialog. I have created a edit box variable in my dialog and create a member variable within the main dialog window. When the serial handler is called, I store the serial message into the CString variable and use SetwindowText() to display the st...

recovered messages folders again and again and cant visualize
Today windows mail "crashed" with no obvious reason. After that a "recovered messages" folder started to appear, so moved my "recovered" out the recovered folder to it's original position. I was almost glad at that point, but now on a closer look what I have is: My folders have the full amount of my messages, and my messages keep the subject and file size, but I can't visualize any content (just an error message instead saying message can't show), I'm surprised because those are not 0 kb files... Besides, every lauch I get the recove...

Unbound Text Box Help
I have an unbound text box called TYPE, that I want to display the name of a transaction type. See below code. I have added this to the BeforeUpdate and the AfterUpdate and the TYPE remains blank. This is DSform and the infromation is for display purposes only. Does anyone have any suggestions on why this is not working and what I can do to correct my ways. Matt Private Sub TYPE_BeforeUpdate() If Me.TRANS_TYP = "S" Then Me.TYPE = "SALES FORECAST" End If If Me.TRANS_TYP = "I" Then Me.TYPE = "INVOICE" End If ...

Fill in text from drop down list box in Excel
Hello, I have created a drop down list box but the list is getting too big and the user has to scroll down the list to select the data. Is there a feature I can use to display the data that start with the same string. For example: If I type "Be" in my box, the box could display the list that start with "BE or Be". I created the drop down list by using "Data", chose "Validation", and chose "List" from the "Allow" tab. Thanks for your help. Bexi Bexi If your drop-down list if from Data Validation, you cannot have Autocomplete. T...

muti search box
I have added a multi search box to my site but I can't get the other site to come up when we click there boxes . I have selected Yahoo, e bay, craigslist & the web Am I doing something wrong Please help. Thank Tony aa.saving@yahoo.com On Fri, 10 Aug 2007 15:24:55 -0700, aa.saving@yahoo.com wrote: >I have added a multi search box to my site but I can't get the other >site to come up when we click there boxes . I have selected Yahoo, e >bay, craigslist & the web Am I doing something wrong Please help. >Thank Tony aa.saving@yahoo.com You're asking in the wr...

Exporting Mail box after employee has left company
I'd like to export a mailbox from Exchange 2003. The employee has left the company, and allthough I haven't deleted his user account yet, I would like to know if it is possible to export his account without actually logging in with his username & password and opening outlook as that user. Thanks, Nate Weldon yes; use exmerge.exe to accomplish this... "Nate Weldon" <NateWeldon@discussions.microsoft.com> wrote in message news:674CD1FE-F33E-4734-BC2C-B20210B95A3C@microsoft.com... > I'd like to export a mailbox from Exchange 2003. The employee has left th...

pop up combo box
Hi everyone, When we write a class name in VC++ and type dot(.) then a combo box comes with a list of its members.I want to implement this feature in an edit box.How can I do this? Any help/example/link ??? _____mamnun Thats called intellisense. Look at codeguru/codeproject to see if you can find some sample code. It shouldnt be that hard to implement. Essentially all you are doing is showing/hiding a window with custom content. --- Ajay I know this is not exactly what you want, but it might also be a good starting point http://www.codeproject.com/editctrl/smart_auto_completeasp.asp A...

dependent combo box list, with indirect reference
I would like to create a dependent combo box. I have a cell linked to anothe combo box, say C1. I have one list in D1:D4, another list in E1:E3. In C2, I have value "D1:D4", in C3 I have "E1:E3". For the input range for the combox, I tried "=INDIRECT(IF(C1=1,C2,C3))", but only got an empty list. Is this 'illegal'? Thanks, Iyue Debra Dalgleish shows how to do this with Data|Validation. http://www.contextures.com/xlDataVal02.html Maybe you could use her technique on your comboboxes. If no, then post back with a little more info... Comboboxes from the ...

Form Combo Box
Hi In Cell A1 I have a link to a Index function that uses Indirect(A1) to look up a named range. I also am making a form, and I just want the form to choose between some names that are located in cells "Z1:Z10" of the worksheet and put the selected name in Cell A1. How do you link the combo box to cells Z1:Z10, and put your choice in cell A1? Thanks a lot for your help Hi see: http://www.contextures.com/xlCondFormat01.html -- Regards Frank Kabel Frankfurt, Germany Jeff wrote: > Hi > > In Cell A1 I have a link to a Index function that uses Indirect(A1) > to...

Combo box multiple values persistence
Along with other fields I have defined a field of lookup type of Value list having "X";"Y";"Z"; i it with the multiselection option to select one or all values. The problem is when i created form using wizard option it gets save very easily. but when i make a u.define form and add a text filed on form and set following Data properties. 1. Data Source=Above defined field of the table; 2. Rowsource = Table of values i.e. (X,Y,Z). 3. Bound Column=0 4. Enables=Yes 5. Locked = No When i try to save the records by assigning the combobox to the data...

compiled on visual studio 2003 on windows XP, want to install on windows 7, error
Hello, I have a VB.Net program, which I wrote on my windows XP pc (all recent updates installed), and I created a setup project for installing the program. Now I want to install that program on windows 7, but there I get a message: .Net framework 3.5 needed. Unfortunately, the latest version of the .Net framework is installed on the windows 7 pc. Anyone has experience with this problem? Does anyone knows a solution? Thanks in advance. Steven I think that for most people including me is to run the Windows Update first when they have installed Windows 7. Somehow thi...

Adjusting One Side of a Box
Greetings, When in Design View and a text box, a label box, or a line are selected (just using those as examples), if I hold the "Windows Flag" key down pressing one of the cursor keys, whatever I've selected moves one dot in the direction I want. If I hold the Cntr key down while pressing the cursor key, it appears that I have 4x the sensitivity in moving (i.e., four presses of the cursor key moves the distance of one dot). Is there any way to do the same thing when needing to adjust just one side of a drawn box? Thanks. Ken -- Message posted via AccessMonster.com http:/...

Getting Visual Studio Output Window Text
Hi, When the program loads up, I would like to display the DLL's being loaded like the way it does in Visual Studio Output window, or like the way Adobe reader initializes. Any leads? Thanks, -- Christopher J. Holland [!MVP] http://www.mvps.org/vcfaq/ http://www.codeguru.com http://www.codeproject.com http://www.naughter.com/ http://support.microsoft.com/default.aspx http://msdn.microsoft.com/howto/ http://msdn.microsoft.com/library/ www.flounder.com/mvp_tips.htm ...

Comment box name
I'm using Excel 2003 and use comment boxes extensively. Each time I open/iinsert a new comment box, a name appears that is not mine. How can I change this to have my name appear each time I open/insert a new comment box? Tools>Options>General>User Name. Enter your name in the dialog box. Gord Dibben Excel MVP On Wed, 2 Mar 2005 07:57:04 -0800, hruzam <hruzam@discussions.microsoft.com> wrote: >I'm using Excel 2003 and use comment boxes extensively. Each time I >open/iinsert a new comment box, a name appears that is not mine. How can I >change this to ha...

I want Combo box to be populated depending on customer category
When a customer number is entered on my form, the data populates the form, including the text box for the customer category. I want a combo box on that form to display only choices for that category. How do I modify the query that runs the row source for the combo box? Thanks, Sue On Thu, 7 Jan 2010 21:47:01 -0800, Sue R <SueR@discussions.microsoft.com> wrote: The RowSource should be something like: select * from Choices where Category = Forms!myForm!myCategoryTextbox -Tom. Microsoft Access MVP >When a customer number is entered on my form, the data po...

Combo Box Wizard
I use the Combo Box Wizard to create a cbo to find a record on my form based on a value I select. My values are Last Name and First Name. However, in the drop-down menu I can not see the values but they are there. So I can select something (I can not see) in the cbo and then the record appears on the form. I have checked font and background and that does not seem to be problem. Any help is appreciated. Thanks Lamar Open your form in design view, click on the combo, double click the combo, scroll down and select Properties. In the Properties window select the All tab....

Tools/Macro/Visual Basic Editor
I'm new to this but I have finally hacked out something that does what I want by using a basic template from another user. My code is at the bottom of the message. This changes the fill of the identified shapes based upon some value. The first line of the code: "Private Sub Worksheet_Change(ByVal Target As Range)" was included in the template. I don't know if this is just a title, whether it has some specific syntax or format or what. I also cannot find a list of Me.Shapes. "Face" is a smiley face that was included in the template and "Auto Shape 2&quo...

Need to eliminate a Password change dialog box that appears when u
When a user goes to login to the exchange server VIA the web. When Entering in user/pass a message box appears stating that the password they are using is about to expire. You have 0 day's to change. Then it tell the user to go to Options to change the current password. How I do I eliminate this message? Also what caused this message to be displayed all of a sudden. Thanks for you time. Marcus On Wed, 13 Oct 2004 06:47:05 -0700, Marcus Feldmore <MarcusFeldmore@discussions.microsoft.com> wrote: >When a user goes to login to the exchange server VIA the web. When Entering &g...

Visual studio 2008 VSTO deployment for office 2003
I created a VSTO solution (add-in) with Visual studio 2008 for visio 2003. i used the .NET framework 2.0. I need help with step by step deployment instructions using the setup project. I want to deploy to multiple machines (clients). I have read some instrunctions that includes copying manifests, to deployment location, how do i know the different files i would need to place in the deployment folder? Is the deployment folder the path specified during the setup? How do i grant full trust to the assemblies? I read that i am to do it but don't know how to. I looked at the pre-req...