Hello,
Hope someone can help me with a code for a 3rd combobox.
I was able to find a code to populate 1st 2 combobox, but, unable to find a code to populate the 3rd combobox.
Depending on what is selected in 2nd combobox I want macro to populate the 03rd combobox.
Column A----Column B---------Column C
---AA------Main Sheet------D:\AA\Main.xlsb
---AA------Source Sheet---C:\AA\Source.xlsx
---BB------Instruction------D:\BB\Instruction.txt
If AA is selected in 1st combobox and Main Sheet is selected in 2nd combobox, I want the 3rd combobox to get populated with D:\AA\Main.xlsb from Column C. Same goes for the remaining items.
Below is the code used to populate 1st 2 combobox -
Kindly provide the entire working code.
Have attached sample sheet.
Hope someone can help me with a code for a 3rd combobox.
I was able to find a code to populate 1st 2 combobox, but, unable to find a code to populate the 3rd combobox.
Depending on what is selected in 2nd combobox I want macro to populate the 03rd combobox.
Column A----Column B---------Column C
---AA------Main Sheet------D:\AA\Main.xlsb
---AA------Source Sheet---C:\AA\Source.xlsx
---BB------Instruction------D:\BB\Instruction.txt
If AA is selected in 1st combobox and Main Sheet is selected in 2nd combobox, I want the 3rd combobox to get populated with D:\AA\Main.xlsb from Column C. Same goes for the remaining items.
Below is the code used to populate 1st 2 combobox -
Code:
Option Explicit
Private Sub cbPrimary_Change()
Dim Name As String, R(), Counter As Integer, I As Integer
Name = cbPrimary.Value
For Counter = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(Counter, 1).Value = Name Then
I = I + 1
ReDim Preserve R(I - 1)
R(I - 1) = Cells(Counter, 2).Value
End If
Next Counter
UFSelection.cmSecondary.List = R
End Sub
Private Sub UserForm_Initialize()
Dim Counter As Integer, R
With CreateObject("Scripting.Dictionary")
For Counter = 1 To Cells(Rows.Count, 1).End(xlUp).Row
.Item(Cells(Counter, 1).Value) = ""
Next Counter
R = .keys
End With
cbPrimary.List = R
End Sub
Kindly provide the entire working code.
Have attached sample sheet.