Ok, I modified the macro, so now it will find all items from the Box sheets and list all unique items in column A.
Then it will update all the items as before.
Let me know if this works for you.
Macros Used.
Sub inventory()
Dim lr, lrtot, a, x, y As Long
Dim TSI, NSN As String
TSI = "Total Supply Inventory"
Call listall ' This will ist all unique items [NSN] from all Box sheets.
With Worksheets(TSI)
lrtot = .Range("A" & Rows.Count).End(xlUp).Row
End With
Worksheets(TSI).Range("B2:F" & lrtot).Select
Selection.ClearContents
Do While lrtot > 1
NSN = Worksheets(TSI).Range("A" & lrtot).Value
For Each ws In ActiveWorkbook.Sheets
If ws.Name <> "Individual Items" And ws.Name <> "Total Supply Inventory" Then
With Worksheets(ws.Name)
lr = .Range("A" & Rows.Count).End(xlUp).Row
End With
Do While lr > 1
If Worksheets(ws.Name).Range("A" & lr).Value = NSN Then
Worksheets(ws.Name).Range("B" & lr & ":D" & lr).Copy _
Destination:=Worksheets(TSI).Range("B" & lrtot & ":D" & lrtot)
Worksheets(TSI).Range("E" & lrtot).Value = Worksheets(TSI).Range("E" & lrtot).Value + Worksheets(ws.Name).Range("E" & lr).Value
Worksheets(TSI).Range("F" & lrtot).Value = Worksheets(TSI).Range("F" & lrtot).Value + Worksheets(ws.Name).Range("F" & lr).Value
End If
lr = lr - 1
Loop
End If
Next ws
lrtot = lrtot - 1
Loop
Range("A2").Select
End Sub
Sub listall()
Dim lr, lrtot, a, x, y As Long
Dim TSI, NSN As String
TSI = "Total Supply Inventory"
With Worksheets(TSI)
Columns("AA:AB").Select
Selection.ClearContents
lrtot = .Range("A" & Rows.Count).End(xlUp).Row
End With
If lrtot < 2 Then lrtot = 2
Worksheets(TSI).Range("A2:F" & lrtot).Select
Selection.ClearContents
a = 2
For Each ws In ActiveWorkbook.Sheets
If ws.Name <> "Individual Items" And ws.Name <> "Total Supply Inventory" Then
With Worksheets(ws.Name)
lr = .Range("A" & Rows.Count).End(xlUp).Row
End With
If lr = 1 Then GoTo 20
Worksheets(ws.Name).Range("A2:A" & lr).Copy _
Destination:=Worksheets(TSI).Range("AA" & a)
a = a + lr - 1
End If
20 Next ws
Call ListUniques
With Worksheets(TSI)
lrtot = .Range("AB" & Rows.Count).End(xlUp).Row
End With
Worksheets(TSI).Range("AB2:AB" & lrtot).Copy _
Destination:=Worksheets(TSI).Range("A2")
Columns("AA:AB").Select
Selection.ClearContents
End Sub
Bookmarks