MichaelRSnow
Active Member
- Joined
- Aug 3, 2010
- Messages
- 409
Hi
Any know how to run code off the selection of a combobox list item i.e. as I type in a Combobox a list of items is populated, the list changes as I type more characters. When I then select an item using the mouse click so it populates what I've selected in the Combobox I want it to run some additional code.
Not as I type when the list changes but when I have selected an item, current code below
Any help would be gratefully received
Any know how to run code off the selection of a combobox list item i.e. as I type in a Combobox a list of items is populated, the list changes as I type more characters. When I then select an item using the mouse click so it populates what I've selected in the Combobox I want it to run some additional code.
Not as I type when the list changes but when I have selected an item, current code below
Any help would be gratefully received
VBA Code:
Private Sub ComboBox1_Change()
Dim i As Long
If Not IsArrow Then
With Me.ComboBox1
.List = Worksheets("MBDataLog").Range("Y2", Worksheets("MBDataLog").Cells(Rows.Count, "Y").End(xlUp)).Value
.ListRows = Application.WorksheetFunction.Min(6, .ListCount)
.DropDown
If Len(.Text) Then
For i = .ListCount - 1 To 0 Step -1
If InStr(1, .List(i), .Text, vbTextCompare) = 0 Then .RemoveItem i
Next
.DropDown
End If
'Debugging
End With
End If
Sheets("MBDataChk").Range("B4").Value = ComboBox1
If ComboBox1.ListIndex > -1 Then
TextBox7 = Sheets("MBDataChk").Range("A18").Value 'Email
TextBox5 = Sheets("MBDataChk").Range("A23").Value 'Folder
TextBox3 = Sheets("MBDataChk").Range("A19").Value 'Outcome
TextBox4 = Sheets("MBDataChk").Range("A22").Value 'Team
If Sheets("MBDataChk").Range("B1").Value = "" Then
ListBox1 = Sheets("MBDataChk").Range("A24").Value
Else
End If
If Sheets("MBDataChk").Range("B2").Value = "" Then
ListBox2 = Sheets("MBDataChk").Range("A25").Value
Else
End If
If Sheets("MBDataChk").Range("C2").Value = "" Then
ListBox3 = Sheets("MBDataChk").Range("A27").Value
Else
End If
TextBox14 = Sheets("MBDataChk").Range("A26").Value 'Email Date
TextBox13 = Sheets("MBDataChk").Range("A27").Value 'Email Count
If TextBox7.Text = "Yes" Then
TextBox19.BackColor = RGB(112, 173, 71)
ElseIf TextBox7.Text = "Yes by Exception" Or TextBox7.Text = "Yes with conditions" Or TextBox7.Text = "Refer to Lender" Then
TextBox19.BackColor = RGB(255, 217, 102)
ElseIf TextBox7.Text = "" Or TextBox7.Text = "More Detail/Information" Then
TextBox19.BackColor = RGB(174, 170, 170)
ElseIf TextBox7.Text = "No" Then
TextBox19.BackColor = RGB(250, 67, 52)
End If
Else
End If
End Sub