I really hope that someone can help me. I have a code that works for the file called "Dummy File Current" which is attached. It looks up the part number under the Want tab and pulls in the dates under the respective tabs and places it under the respective column under the Want tab. Now that I've added some more tabs in the excel file called "Want New", I DO NOT know how to rework the code where it does the same function as "Dummy File Current." Can someone please help so that the code under "Dummy File Current", which is provided below, will do the same for the "Want New."
PHP Code:
Option Explicit
Sub DummyFile() Dim a, i As Long, ii As Long, w, e With CreateObject("Scripting.Dictionary") .CompareMode = 1 For i = 6 To 9 a = Sheets(i & IIf(i = 6 Or i = 7, "R", "W") & " WIW").Cells(1) _ .CurrentRegion.Value For ii = 2 To UBound(a, 1) If a(i, 5) <> "" Then For Each e In Split(a(ii, 5), ", ") If Not .exists(Trim$(e)) Then ReDim w(1 To 4) Else w = .Item(Trim$(e)) End If w(i - 5) = w(i - 5) & _ IIf(w(i - 5) <> "", " , ", "") & a(ii, 2) .Item(Trim$(e)) = w Next End If Next Next With Sheets("want").Cells(1).CurrentRegion .Columns("b:e").Offset(1).ClearContents a = .Value End With For i = 2 To UBound(a, 1) If .exists(a(i, 1)) Then For ii = 1 To 4 a(i, ii + 1) = .Item(a(i, 1))(ii) Next End If Next End With Sheets("want").Cells(1).CurrentRegion.Value = a End Sub
Bookmarks