Forum Discussion
guitar713
Apr 09, 2024Copper Contributor
Combo Box dynamic code not working
Hello, I have tried to use a code that works in one program but not another program to dynamicly populate comboboxes. Can someone help me resolve this. The code is as follows: With frmDataEntry...
HansVogelaar
Apr 09, 2024MVP
What exactly is the problem?
- Do you get an error message? If so, what does it say?
- Does the code run, but without setting the row source of the combo box?
- Does the code run, but it sets the row source incorrectly?
- Something else?
guitar713
Apr 09, 2024Copper Contributor
I do not get any specific error message. It just stops at this point in the code and says to debug....
- HansVogelaarApr 09, 2024MVP
Could you attach a small sample workbook demonstrating the problem (without sensitive data), or if that is not possible, make it available through OneDrive, Google Drive, Dropbox or similar?
- guitar713Apr 09, 2024Copper Contributor
HansVogelaar here is a copy of my code... open it up by pressing the ECO button, then goto the select in the URGENCY section, this is where the problems are located.
- HansVogelaarApr 09, 2024MVP
Try this:
Private Sub cmbURGENCY_Change() Select Case cmbURGENCY Case "HAND CARRY - HIGH – 1 Bus Days" FrameURGENCYOVERALL.BackColor = RGB(245, 99, 75) Sheet4.Range("C2", Sheet4.Range("C" & Rows.Count).End(xlUp)).Name = "Dynamic" Case "FAST - MEDIUM – 2-3 Bus Days" FrameURGENCYOVERALL.BackColor = RGB(255, 251, 0) Sheet4.Range("D2", Sheet4.Range("D" & Rows.Count).End(xlUp)).Name = "Dynamic" Case "NORMAL - LOW – 5 Bus Days" FrameURGENCYOVERALL.BackColor = RGB(155, 247, 141) Sheet4.Range("E2", Sheet4.Range("E" & Rows.Count).End(xlUp)).Name = "Dynamic" Case Else FrameURGENCYOVERALL.BackColor = vbWhite Sheet4.Range("F2", Sheet4.Range("F" & Rows.Count).End(xlUp)).Name = "Dynamic" End Select Me.cmbCARRYREASON.RowSource = "Dynamic" cmbCARRYREASON.ListIndex = 0 End Sub