Dear Expets
When I run following procedure, then computer hangs then I have to press ALT+CTRL+DEL or Power off.
What is wrong? Please help
[vba]
Sub Findunique()
Dim dateRay As Range
Dim xVal As Variant
Dim myColl As New Collection
Dim FDATE As Date
Dim LDATE As Date
FDATE = Sheets("Rpt_Date").TextBox1.Value '01-07-06
LDATE = Sheets("Rpt_Date").TextBox2.Value '15-06-07
With Worksheets("weights")
Set dateRay = .Range("C2", .Range("C" & .Rows.Count).End(xlUp))
End With
On Error Resume Next
For Each xVal In dateRay
Range("B3").Value = xVal
If DateValue(xVal.Value) >= DateValue(FDATE) _
And DateValue(xVal.Value) <= DateValue(LDATE) Then
myColl.Add Item:=xVal.Offset(0, 1), key:=CStr(xVal.Offset(0, 1))
End If
Next xVal
On Error GoTo 0
Sheets("Rpt_date").ComboBox1.CLEAR
For Each xVal In myColl
Sheets("rpt_date").ComboBox1.AddItem xVal
Next xVal
End Sub
[/vba]