L
LaDdIe
Hi,
I have the following code;
Private Sub UserForm_Initialize()
Dim Cell As Range, c As Range
ListBox1.Clear
For Each Cell In Sheets("Week1").Range("A4:A61")
If Cell.Value <> "" Then
For Each c In Sheets("Rota Template").Range("B5:B107")
If Cell.Value = c.Value Then
Exit For
End If
If c.Address = "$B$107" Then
With ListBox1
Me.ListBox1.AddItem Cell.Value
.List(.ListCount - 1, 1) = Cell.Offset(0, 1).Value
.List(.ListCount - 1, 2) = Cell.Offset(0, 2).Value
End With
End If
Next
End If
Next
End Sub
How can I modify it to exclude matching items already on ListBox2
Thanks.
I have the following code;
Private Sub UserForm_Initialize()
Dim Cell As Range, c As Range
ListBox1.Clear
For Each Cell In Sheets("Week1").Range("A4:A61")
If Cell.Value <> "" Then
For Each c In Sheets("Rota Template").Range("B5:B107")
If Cell.Value = c.Value Then
Exit For
End If
If c.Address = "$B$107" Then
With ListBox1
Me.ListBox1.AddItem Cell.Value
.List(.ListCount - 1, 1) = Cell.Offset(0, 1).Value
.List(.ListCount - 1, 2) = Cell.Offset(0, 2).Value
End With
End If
Next
End If
Next
End Sub
How can I modify it to exclude matching items already on ListBox2
Thanks.