I hv a workbook with 3 sheets viz. OpgStk,Receipts,ClgStock
In OpgStk and Receipts sheets, I have columns for ItemName ("K") and ItemLotNumber ("J"). There are about 1000 ItemNames and for each ItemName there are about 15 ItemLotNumbers in OpgStk and Receipts Sheets. I need to copy the ItemLotNumber from both the OpgStk and Receipts Sheets in the ClgStock Sheet. I have tried with the following but not successful. Of course, I have not considered Receipts Sheet in this as I thought once I get through with OpgStk and I can proceed to Receipts on the same lines. Data start from B7 and ends at P15007, with row 6 for column headers.
Sub ClgStkPost()
Dim K As Long, r As Range, v As Variant
K = 7
Dim w1 As Worksheet, w2 As Worksheet
Set w1 = Sheets("OpgStk")
Set w2 = Sheets("ClgStk")
w1.Activate
For Each r In Intersect(Range("K:K"), ActiveSheet.UsedRange)
v = r.Value
If InStr(v, "S4") > 0 Then
r.Copy w2.Range(K, 1)
K = K + 1
End If
Next r
End Sub
Any help?
Bookmarks