Dear All,
I have this simple code copied from somewhere else but I can' t check if it works because it stops immediately:
Private Sub CommandButton2_Click()
With Me.ListBox1
.ColumnCount = rRng.Columns.Count
.ColumnWidths = "0,40,50,60,60,0,0,0,0,0,0,0,0,0,0,150,120,100,65,70,50"
.MultiSelect = fmMultiSelectMulti
.ListIndex = -1
End With
With Rng
For i = 1 To .Rows.Count
If .Cells(i, 2) = 2 Then
ListBox2.AddItem .Cells(i, 1).Value
For j = 2 To .Columns.Count
ListBox2.List(ListBox2.ListCount - 1, j - 1) = .Cells(i, j).Value
Next j
End If
Next i
End With
End Sub
Runtime error 424 and Me.ListBox1 returns Null as value, it looks like the listbox is not activated.
How can I solve it?
Apart from that is 1 day that I'm going crazy trying to find a simple code to fill the listbox filtering the rows depending on values of one column.
I undestand that I have 2 options: one is to filter the values of the origin and show only all the ones remaining or the other option is to check line by line the values and add each line.
Do you have any suggestion for a simple solution?
Thank you!
I have this simple code copied from somewhere else but I can' t check if it works because it stops immediately:
Private Sub CommandButton2_Click()
With Me.ListBox1
.ColumnCount = rRng.Columns.Count
.ColumnWidths = "0,40,50,60,60,0,0,0,0,0,0,0,0,0,0,150,120,100,65,70,50"
.MultiSelect = fmMultiSelectMulti
.ListIndex = -1
End With
With Rng
For i = 1 To .Rows.Count
If .Cells(i, 2) = 2 Then
ListBox2.AddItem .Cells(i, 1).Value
For j = 2 To .Columns.Count
ListBox2.List(ListBox2.ListCount - 1, j - 1) = .Cells(i, j).Value
Next j
End If
Next i
End With
End Sub
Runtime error 424 and Me.ListBox1 returns Null as value, it looks like the listbox is not activated.
How can I solve it?
Apart from that is 1 day that I'm going crazy trying to find a simple code to fill the listbox filtering the rows depending on values of one column.
I undestand that I have 2 options: one is to filter the values of the origin and show only all the ones remaining or the other option is to check line by line the values and add each line.
Do you have any suggestion for a simple solution?
Thank you!