Results 1 to 6 of 6

Thread: Fill Combobox Based On Values In Adjacent Column

  1. #1
    Junior Member
    Join Date
    Sep 2013
    Posts
    7
    Rep Power
    0

    Fill Combobox Based On Values In Adjacent Column

    hi all ,

    id like to seek some help regarding my problem. I have a worksheet with three columns in it. the first column is the "channel column", the second column is the "status column"; which indicates the status of the channel column wheter it is active or not, the third column is the "circuit name" column which indicates the circuit name for each channel. now, the status of the channel depends on the value of the circuit name column.. if the cell in the circuit name column is blank, the status column has an if formula that automatically changes it to vacant status, otherwise active.

    i added command buttons namely "active" and "vacant". this buttons correspons to active userform and vacant useform when clicked. in each userform there is a combobox. My problem is how would i fill the combobox in the active userform with the active channels only , and same in the vacant userform with vacant channels only. the comboboxes list should correspond to changes in the status column, that is if one channel gets an active status it would be deleted from the vacant userform and be added to the active userform.

    i uploaded my workbook for your reference.

    regards,
    ryan

  2. #2
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,402
    Rep Power
    10
    Use this in the userform for active channels...

    Code:
    Private Sub UserForm_Activate()
    
        Call ActiveVacant("Active")
        
    End Sub
    
    Function ActiveVacant(strActiveVacant As String) As Variant
    
        Dim lng As Long
        Dim var As Variant
        var = Range("D2:E100").Value2
        For lng = LBound(var) To UBound(var)
            If UCase(var(lng, 1)) = UCase(strActiveVacant) Then
                Me.ComboBox1.AddItem var(lng, 2)
            End If
        Next lng
        
    End Function
    You can replicate for vacant also. But since your vacant channels don't have any value in column E, it will add empty items to the combobox. Not sure why you want that.
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  3. #3
    Junior Member
    Join Date
    Sep 2013
    Posts
    7
    Rep Power
    0
    the comboboxes should display the channels that are active or vacant.. so if a cell in column E does not have a value then the vacant userform should display the vacant channel correspoding to that vacant cell.

  4. #4
    Senior Member alansidman's Avatar
    Join Date
    Apr 2012
    Posts
    125
    Rep Power
    14
    Last edited by DocAElstein; 06-10-2023 at 01:18 PM.

  5. #5
    Junior Member
    Join Date
    Sep 2013
    Posts
    7
    Rep Power
    0
    sorry didnt know about that.. it will never happen again..

  6. #6
    Junior Member
    Join Date
    Sep 2013
    Posts
    7
    Rep Power
    0
    just wandering why my post here changed title, anyway sorry for the trouble.. its my first post here..it will never happen again
    https://www.youtube.com/channel/UCnx...RbjOo_MO54oaHA
    Last edited by DocAElstein; 06-10-2023 at 01:19 PM.

Similar Threads

  1. Replies: 10
    Last Post: 08-29-2013, 08:20 PM
  2. Replies: 1
    Last Post: 08-20-2013, 04:31 PM
  3. Replies: 5
    Last Post: 08-10-2013, 04:15 PM
  4. Replies: 16
    Last Post: 04-19-2013, 08:20 PM
  5. Replies: 3
    Last Post: 08-05-2012, 09:16 PM

Posting Permissions

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