Results 1 to 2 of 2

Combo Box with 2 colums, not displaying correctly

Threaded View

  1. #1
    Registered User
    Join Date
    11-29-2008
    Location
    Houston
    MS-Off Ver
    Office 2003, and 2007
    Posts
    77

    Combo Box with 2 colums, not displaying correctly

    I have the below code for an AxtiveX combo box, which appears on sheet12.
    Sub Agent_Options()
        
        Application.EnableEvents = False
        With CB_Agent_Select    'CB_Agent_Select is an ActiveX Combo Box, which appears on Sheet12
            .Clear
            .ColumnCount = 2
            .ColumnWidths = "60;140.5"
            .ListRows = 7
            
            'The "AddItem" and "List...) lines essentially concatenates
            'the values to read "IG-01  Argon" in the combo box.
            .AddItem "IG-01"
            .List(0, 1) = "Argon"
            .AddItem "IG-55"
            .List(1, 1) = "Argon / Nitorgen"
            .AddItem "IG-100"
            .List(2, 1) = "Nitrogen"
            .AddItem "IG-541"
            .List(3, 1) = "Argon / Nitrogen/ CO2"
            .AddItem "FK-5-1-12"
            .List(4, 1) = "Novec"
            .AddItem "HFC-23"
            .List(5, 1) = "FE-13"
            .AddItem "HFC-125"
            .List(6, 1) = "Ecaro"
            .AddItem "HFC-227ea"
            .List(7, 1) = "FM-200"
            '.AddItem "HFC-236fa"
            '.List(8, 1) = ""
            '.AddItem "HFC Blend B"
            '.List(9, 1) = ""
        End With
        Application.EnableEvents = True
        
        'This code examinst the users choice from the "Combo Box".
        'At this time there is limited calculation methods so this
        'warning advised the user to the limited calculation methods available
        If CB_Agent_Select.ListIndex = -1 Then
            MsgBox "The Ansul Inert Calculation Method Has Not Been Developed" & vbCrLf & "At Present, Only FM-200 Agent May Be Calculated", vbCritical, "Ansul Inergen Calc"
        End If
    End Sub
    I'm having the following problems:
    1. The combo box displays the concatenated value correctly (IG-01 Argon) when I'm in the box, but not after the selection is made. It then only shows the "IG-01" value. What am I doing wrong?
    2. The MsgBox is trying to test for the value selected by the user. I've tried 0, 1, and -1 to get the message to fire but it's not. It should fire with "EITHER" the 1st, 2nd, OR 3rd "AddItem" but it's not firing on anyone of the selections. Any ideas?
    3. Can the ".AddItem..." and ".List", be written differently or on a single line?
    Last edited by DM2; 02-27-2015 at 04:05 PM.
    Regards,
    Dan
    Real world knowledge isn't dropped from a parachute in the sky but rather acquired in tiny increments from a variety of sources including panic and curiosity.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] UserForm not displaying correctly
    By dazbear in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2015, 02:17 AM
  2. date is not displaying correctly
    By Deb in forum Excel General
    Replies: 4
    Last Post: 02-08-2014, 07:28 PM
  3. UserForm not Displaying Correctly
    By Strugglin in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-01-2009, 09:02 AM
  4. Userform not displaying correctly
    By Trefor in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-31-2006, 05:30 AM
  5. [SOLVED] Fonts not displaying correctly
    By Carolyn in forum Excel General
    Replies: 0
    Last Post: 06-20-2005, 10:05 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1