• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Macro to search item code in 2 sheet and copy specified column to one sheet.

jack999

Member
I have an excel work book with 2 sheets named STK and DATA.

STK sheets contain 3 columns, Item code, Item Name, Quantity.

Data sheet contain 3 Columns, Item code, Item Name, Tax.

I want to add Tax column from DATA sheet to STK sheet. Pls. help me.
 

Attachments

  • STK.xlsx
    13.9 KB · Views: 4
I have an excel work book with 2 sheets named STK and DATA.

STK sheets contain 3 columns, Item code, Item Name, Quantity.

Data sheet contain 3 Columns, Item code, Item Name, Tax.

I want to add Tax column from DATA sheet to STK sheet. Pls. help me.
 

Attachments

  • STK.xlsx
    16.6 KB · Views: 8
I got this macro from site, but this is not copying fully. Can you please check this macro and correct it for me.

Sub CopyBasedonSheet1()

Dim i As Long
Dim j As Long
Sheet1LastRow = Worksheets("STK").Range("A" & Rows.Count).End(xlUp).Row
Sheet2LastRow = Worksheets("DATA").Range("A" & Rows.Count).End(xlUp).Row

For j = 1 To Sheet1LastRow
For i = 1 To Sheet2LastRow
If Worksheets("STK").Cells(j, 1).Value = Worksheets("DATA").Cells(i, 1).Value Then
Worksheets("DATA").Cells(j, 9).Value = Worksheets("STK").Cells(i, 3).Value

Else
End If
Next i
Next j
End Sub
 
Back
Top