This code should Update Column "A" of Sheet1, "Raw Data".
Sub MG01Aug10
Dim Rng As Range, Dn As Range, n As Long, k As Variant, c As Long
Set Rng = Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Dn In Rng
If Not .Exists(Dn.Value) Then
.Add Dn.Value, Dn
Else
Set .Item(Dn.Value) = Union(.Item(Dn.Value), Dn)
End If
Next
For Each k In .keys
.Item(k).Resize(, 3).Sort .Item(k).Offset(, 2)(1)
Next k
ReDim Ray(1 To Rng.Count, 1 To 3)
For Each Dn In Rng
If Dn.Offset(, 2) <= "C" Then
c = c + 1
Ray(c, 1) = Dn.Value
Ray(c, 2) = Format(Dn.Offset(, 1).Value, "hh:mm AM/PM")
Ray(c, 3) = Dn.Offset(, 2).Value
End If
Next Dn
For Each Dn In Rng
If Dn.Offset(, 2) > "C" Then
c = c + 1
Ray(c, 1) = Dn.Value
Ray(c, 2) = Format(Dn.Offset(, 1).Value, "hh:mm AM/PM")
Ray(c, 3) = Dn.Offset(, 2).Value
End If
Next Dn
Range("A2").Resize(UBound(Ray, 1), 3).Value = Ray
End With
End Sub
Regards Mick
Bookmarks