VBA Code:
If Range("B2") = "" Then
Exit Sub
End If
mycol = Sheets("Count sheet").Rows(1).Find("Defect", , xlValues, , xlByColumns, xlPrevious).Column
Set CngB = Columns(mycol)
RngB = Sheets("Inventory management").Range("B2").Value
For Each cell In Sheets("Count sheet").Range("A2:A8000")
If cell.Value = RngB Then Sheets("Count sheet").Cells(cell.Row, mycol).Offset(, 2) = Sheets("Inventory management").Range("E2")
Next
Sheets("Count sheet").Columns(mycol + 2).Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A2:F2").Select
Selection.Copy
Sheets("Added to inv").Select
Range("A5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("4:4").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Range("A5").Select
Sheets("Inventory management").Range("E2").ClearContents
Sheets("Inventory management").Range("B2").ClearContents
End Sub