View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
LaDdIe LaDdIe is offline
external usenet poster
 
Posts: 131
Default Remove Item from ListBox1

Thanks again

"JLGWhiz" wrote:

Here is the syntax,. but the best method is not to load duplicates.

ListBox1.RemoveItem (<ListIndex)


"LaDdIe" wrote:

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.