Results 1 to 8 of 8

Change Combobox in userform

Threaded View

  1. #1
    Registered User
    Join Date
    03-26-2019
    Location
    Spain
    MS-Off Ver
    Office 2010
    Posts
    4

    Question Change Combobox in userform

    Hi VBA users!

    Please I need some help to solve a problem that I have with an UserForm. I explain the situation.

    I have more than 20 combobox into the Userform which have the same options (Yes, No, N/A)

    I tried to create a class module but it doesn't work.

    The code:

    Into the UserForm:
    sub Combobox1_Change()
        Dim Combo_GPS As Combos
        Set Combo_GPS.value = New combos
        Combo_GPS.Change_Combo
    
        set Combobox1 = Nothing
    end sub
    Into class module (the value in red generates the error)

    Public Sub Change_Combo()
        Select Case Combos.Value
            Case "N/A"
                Selected_Combo.BackColor = RGB(150, 150, 150) 'grey
        
            Case "No"
                Selected_Combo.BackColor = RGB(255, 0, 0) 'red
            
            Case "Sí"
                Selected_Combo.BackColor = RGB(0, 255, 0) 'green
            
            Case "En curso"
                Selected_Combo.BackColor = RGB(255, 230, 0) 'yellow
        End Select
    Basically I want to call this class module each time that I need to use this code to avoid repeat for each combobox.

    If you have the solution or better idea, I will appreciate it a lot.

    Note: please explain for rookies, I am not advanced for Macros, I am trying to learn, but this kind of explanation don't appear on Internet ^^

    Thanks!
    Last edited by davesexcel; 03-26-2019 at 12:45 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. ComboBox in USERFORM used to change which sheet output goes
    By InvalidTxtString in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-06-2016, 06:31 PM
  2. [SOLVED] Userform: Change Combobox list based on a second ComboBox selection
    By Groovicles in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-11-2016, 03:45 PM
  3. Userform Combobox to populate form: Can I change the order of the columns in the combobox?
    By CraigWiggins in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-31-2014, 12:14 PM
  4. [SOLVED] cannot change userform combobox range error 457
    By cfinch100 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-08-2014, 05:22 PM
  5. Change Userform Label based on ComboBox Selection
    By rbyrd023 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-02-2014, 09:25 AM
  6. [SOLVED] Change Labels in Userform based on selection in ComboBox
    By johnw993 in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 01-03-2013, 10:52 PM
  7. [SOLVED] UserForm ComboBox Change Event Question
    By tja1964 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2012, 07:21 PM

Tags for this Thread

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