...
I've got some code that works when I explicitly define the range. I'm wondering why it won't using named ranges. It specifically throws "Could not List Property" error on "Me.ComboBox1.List(Me.ComboBox1.ListIndex, 1)" The form activation seems to accept using named ranges for ComboBox1. Is there a way to do this using named ranges?
Private Sub ComboBox1_Change()
Dim v As Variant
Dim i As Long
If Me.ComboBox1.ListIndex = -1 Then Exit Sub
Set wb = ThisWorkbook
Set ws = wb.Sheets(msSHEET_LST)
With ws
' v = .Range("AY2", .Range("BB" & Rows.Count).End(xlUp)).value '\\\works
v = .Range("Name1,Name2,Name3,Name4").value '\\\does not work
With ComboBox2
.Clear
.ColumnCount = 3
.ColumnWidths = ";0;0"
For i = 1 To UBound(v, 1)
If v(i, 2) = Me.ComboBox1.List(Me.ComboBox1.ListIndex, 1) Then
.AddItem v(i, 1)
.List(.ListCount - 1, 1) = v(i, 3)
.List(.ListCount - 1, 2) = v(i, 4)
End If
Next i
End With
End With
End Sub
Bookmarks