Hi,
I have attached the excel 2003 file complete with the below VBA and data to be changed, the VBA below works and currently counts the duplicates in Column A and applies the values based on Column C but when I have specific data in column I such as MPL002C 2 of 3 or 'MPL002C 3 of 3 then I do not want it to count those rows.
Sub Test()
'
'
Dim dic As Object, a, x, i As Long
Set dic = CreateObject("Scripting.Dictionary")
dic.CompareMode = 1
dic("Test1") = VBA.Array(6, 6, 0)
dic("Test2") = VBA.Array(2.5, 2.5, 0)
dic("Test3") = VBA.Array(2.5, 2.5, 5, 10, 15)
With Range("a2", Range("a" & Rows.Count).End(xlUp)).Resize(, 3)
a = .Value
x = .Parent.Evaluate("if(row(" & .Columns(1).Address & "),countif(" _
& .Columns(1).Address & "," & .Columns(1).Address & "))")
For i = 1 To UBound(a, 1)
If dic.exists(a(i, 3)) Then
x(i, 1) = Application.Min(x(i, 1) - 1, UBound(dic(a(i, 3))))
a(i, 1) = dic(a(i, 3))(x(i, 1))
Else
a(i, 1) = ""
End If
Next
.Columns("h").Value = a
End With
End Sub
Could anybody please help with this, I know its not easy but any help is appreciated.
David
Bookmarks