bbqsmokeman
New Member
Hello
I have a Userform that has multiple Comboboxes and am trying to populate 2 comboboxes (cbAgent & cbAgentName) with names based on combobox (cbMU) but single names and not multiple. Right now they pull the data from worksheet GtoICheck (yes the sheet has each name multiple times cause it displays each person with what skills they have and this works perfectly) but I need to have cbAgent and cbAgentName show the name only once for each person and each MU depending on what number is chosen from cbMU (I do not want the duplicate names on the worksheet to be removed-just on the comboboxes)
I am also at a loss of how to get the listbox (lbData) to display the opposite. I want lbData to display all data but using .colorindex or .colorinterior to show red if there is a mismatch. I can do the conditional format on the worksheet but cannot figure out how to display it in the listbox and I can only do that once I figure out how to display the information.
I do have the code I have been trying to revise to make it work and its in the workbook I am supplying opposed to adding mutliple code on the site. I use to have an array in cbMU but that was alot of coding to add whats needed and names would require alot of constant updating if a agent moves to another group, etc.
Userform Initialize code below:
cbMU code to fill comboboxes and listbox
I will add a sample workbook shortly
In the workbook I have col K explaining details to ask / assistance needed.
Any help is greatly appreciated
I have a Userform that has multiple Comboboxes and am trying to populate 2 comboboxes (cbAgent & cbAgentName) with names based on combobox (cbMU) but single names and not multiple. Right now they pull the data from worksheet GtoICheck (yes the sheet has each name multiple times cause it displays each person with what skills they have and this works perfectly) but I need to have cbAgent and cbAgentName show the name only once for each person and each MU depending on what number is chosen from cbMU (I do not want the duplicate names on the worksheet to be removed-just on the comboboxes)
I am also at a loss of how to get the listbox (lbData) to display the opposite. I want lbData to display all data but using .colorindex or .colorinterior to show red if there is a mismatch. I can do the conditional format on the worksheet but cannot figure out how to display it in the listbox and I can only do that once I figure out how to display the information.
I do have the code I have been trying to revise to make it work and its in the workbook I am supplying opposed to adding mutliple code on the site. I use to have an array in cbMU but that was alot of coding to add whats needed and names would require alot of constant updating if a agent moves to another group, etc.
Userform Initialize code below:
Code:
Private Sub UserForm_Initialize()
Dim v, e
With Sheets("GtoICheck").Range("d2:d500")
v = .Value
End With
With CreateObject("scripting.dictionary")
.comparemode = 1
For Each e In v
If Not .exists(e) Then .Add e, Nothing
Next
If .Count Then Me.cbAgentName.List = Application.Transpose(.keys)
End With
tbDate.Value = Now
tbDate = Format(tbDate.Value, "mm/dd/yyyy")
Me.cbMU.List = Worksheets("GtoICheck").Range("R2:R50").Value
Me.cbMuUpdated.List = Worksheets("GtoICheck").Range("R2:R50").Value
'Me.tbDate.Value = Format(Date, "mm/dd/yy")
'Me.tbDate.Text = Format(Now(), "mm/dd/yyyy")
With tbDate
'.Text = "mm/dd/yyyy"
'.SetFocus
'.SelStart = 0
'.SelLength = Len(.Text)
cbGU.AddItem ""
cbGU.AddItem "Sys1"
cbGU.AddItem "Sys2"
cbAuditDWM.AddItem ""
cbAuditDWM.AddItem "Daily"
cbAuditDWM.AddItem "Weekly"
cbAuditDWM.AddItem "Monthly"
cbSkFrom.AddItem ""
cbSkFrom.AddItem "0"
cbSkFrom.AddItem "1"
cbSkFrom.AddItem "5"
cbSkFrom.AddItem "9"
cbSkTo.AddItem ""
cbSkTo.AddItem "0"
cbSkTo.AddItem "1"
cbSkTo.AddItem "5"
cbSkTo.AddItem "9"
cbResetConfirm.AddItem ""
cbResetConfirm.AddItem "Skill Change"
cbResetConfirm.AddItem "Skill Reset"
cbResetConfirm.AddItem "Name Spell Correction"
cbResetConfirm.AddItem "Agent Removed"
End With
End Sub
cbMU code to fill comboboxes and listbox
Code:
Private Sub cbMU_Change()
Dim Rng As Range
Dim c As Range
Dim s As String
s = Me.cbMU
Me.cbAgentName.Clear
Me.cbAgent.Clear
Set Rng = Worksheets("GtoICheck").Range("A:A").SpecialCells(xlCellTypeConstants, 23)
For Each c In Rng.Cells
If c = s Then
Me.cbAgentName.AddItem c.Offset(, 1).Value
Me.cbAgent.AddItem c.Offset(, 1).Value
Me.cbSkName.AddItem c.Offset(, 2).Value
Me.lbMSN.AddItem c.Offset(, 2).Value
Me.lbData.AddItem c.Offset(, 1).Value
End If
Next c
End Sub
I will add a sample workbook shortly
In the workbook I have col K explaining details to ask / assistance needed.
Any help is greatly appreciated
Attachments
Last edited: