E
Ewing25
I have some code and it works fine for me on my computer. But when i send it
to someone else and they open it. It comes up with a compile error "cant find
library"
Here is the code any idea what might be causing this?
Sub RemoveDuplicates()
Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection
Set AllCells = Sheet1.Range("H2:H1000")
' The next statement ignores the error caused
' by attempting to add a duplicate key to the collection.
On Error Resume Next
For Each Cell In AllCells
NoDupes.Add Cell.Value, CStr(Cell.Value)
' Note: the 2nd argument (key) for the Add method must be a string
Next Cell
' Resume normal error handling
On Error GoTo 0
' Add the sorted, non-duplicated items to a ListBox
For Each Value In NoDupes
On Error Resume Next
UserForm3.ListBox1.AddItem Value
Next Value
' Show the UserForm
UserForm3.Show
End Sub
to someone else and they open it. It comes up with a compile error "cant find
library"
Here is the code any idea what might be causing this?
Sub RemoveDuplicates()
Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection
Set AllCells = Sheet1.Range("H2:H1000")
' The next statement ignores the error caused
' by attempting to add a duplicate key to the collection.
On Error Resume Next
For Each Cell In AllCells
NoDupes.Add Cell.Value, CStr(Cell.Value)
' Note: the 2nd argument (key) for the Add method must be a string
Next Cell
' Resume normal error handling
On Error GoTo 0
' Add the sorted, non-duplicated items to a ListBox
For Each Value In NoDupes
On Error Resume Next
UserForm3.ListBox1.AddItem Value
Next Value
' Show the UserForm
UserForm3.Show
End Sub