Results 1 to 6 of 6

Show text immediately in Combobox

Threaded View

  1. #1
    Forum Contributor
    Join Date
    08-01-2012
    Location
    rotterdam, holland
    MS-Off Ver
    Excel 2013
    Posts
    170

    Show text immediately in Combobox

    I first need to click before I can see the options in the comboboxes. How do I automatically let it show the text? Now its empty (first click the macrobutton.) Thanks!

    Mirjam.xlsm


    Option Explicit
    
    Private Sub ComboBox1_Change()
    
    Dim index As Integer
    index = ComboBox1.ListIndex
    
    ComboBox2.Clear
    
    Select Case index
        Case Is = 0
            With ComboBox2
                .AddItem "To Kill a Mockingbird"
                .AddItem "1984 by George Orwell"
                .AddItem "Pride and Prehudice"
                .AddItem "Harry Potter and the Sorcerer's Stone"
            End With
        Case Is = 1
            With ComboBox2
                .AddItem "Dark Lover"
                .AddItem "Twilight"
                .AddItem "Dead Until Dark"
                .AddItem "Darkfever"
            End With
        Case Is = 2
            With ComboBox2
                .AddItem "Ender's Game"
                .AddItem "Dune"
                .AddItem "Brave New World"
                .AddItem "Foundation"
            End With
    End Select
    
    End Sub
    
    Private Sub CommandButton1_Click()
    
    Dim iRow As Long
    Dim ws As Worksheet
    Set ws = Worksheets("Projecten")
    Dim strRange As String
    
                
     Range("A" & Rows.Count).End(xlUp)(2).Value = Me.ComboBox1.Value
      Range("B" & Rows.Count).End(xlUp)(2).Value = Me.ComboBox2.Value
      
      
      With ws
    
       Range("C" & Rows.Count).End(xlUp)(2).Value = Me.txtOff.Value
      
       End With
       
    End Sub
    
    
    Private Sub UserForm_Initialize()
    
    With ComboBox1
        .AddItem "Fiction"
        .AddItem "Romance"
        .AddItem "Science - Fiction"
    End With
    
    End Sub
    Last edited by IKZOUHETNIETWETEN; 11-27-2014 at 03:16 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 13
    Last Post: 11-15-2014, 07:09 AM
  2. [SOLVED] How to show all text when hoover with mouse on items in ComboBox Dropdown?
    By tnuis in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-09-2013, 02:52 PM
  3. Replies: 1
    Last Post: 07-19-2012, 02:27 PM
  4. Filling Combobox Based on another combobox.text value.
    By D_Rennie in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 02-18-2012, 01:20 AM
  5. Show UserForm from ComboBox
    By sgp in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-17-2011, 08:48 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