Hi Th,
The problem was with the Headers:
Sub FirstValue() 'THLee
Dim D As Range
Dim LastRow As Long
Dim i As Long, c As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1").Resize(1, 4) = Split("Model|Amount Per Unit|Expected QTY|Expected Cost", "|")
''''' TextToColumns to separate expected cost from model
Range("A2:A" & LastRow).Select
Application.CutCopyMode = False
Selection.TextToColumns Destination:=Range("A2"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=False, _
Semicolon:=False, Comma:=False, Space:=True, Other:=False, FieldInfo _
:=Array(Array(1, 1), Array(2, 1)), TrailingMinusNumbers:=True
c = Rows(1).Find("*", , , , xlByColumns, xlPrevious).column
''''' Delete all but the first of each model
For i = LastRow To 2 Step -1
If Cells(i, 1) = Cells(i - 1, 1) Then
If D Is Nothing Then Set D = Cells(i, 1) Else Set D = Union(Cells(i, 1), D)
End If: Next i
D.EntireRow.Delete
Columns(2).Insert: Columns(c + 1).Cut Range("B1")
Columns.AutoFit
End Sub
Bookmarks