I am trying to work on VBA to copy and paste some cell values to the other worksheets in the same workbook.
In Order List worksheet format is as follows:
(Column A) | (Column B) | (Column C) | (Column D) | (Column E) | (Column F)
Product Code | Product Description | Price | Quantity | Net Amount | Sheet Name
I need to copy the Quantity in Order List sheet and paste to relevant sheet as shown in Column F.
For example, Product Code AAA has Quantity 10 with Sheet Name Art in Order List.
Product Code | Product Description | Price | Quantity | Net Amount | Sheet Name
AAA ... ... 5 ... Art
I need a code to replace AAA's Quantity (Column G) in Art sheet to 10 instead of 5. The Product Code is in Column B of Art Sheet.
(Column B) | ... | (Column G)
Product Code | Other headers | Quantity
AAA ... 10 ' <---- REPLACE WITH 5
I have updated as following:
Dim j As Long, i As Long
j = 18
With Worksheets("Order List")
If Sheets("Order List").Range("F" & j) <> "" And Sheets("Order List").Range("A" & j) <> "" Then
i = Worksheets(.Range("F" & j)).Columns("B").Find(What:=.Range("A" & j).Value, LookIn:=xlValues, LookAt:=xlWhole).Row
Sheets("Order List").Range("D" & j).Copy Destination:=Worksheets(Worksheets("Order List").Range("F" & j)).Range("G" & i)
j = j + 1
End If
There is no error message now, but not replace the quantity either in Art Sheet. Is the destination wrong? Could you please double check it for me? Many thanks

![sample data[2]](https://i.stack.imgur.com/2LZXA.png)
junless the relevant sheet and the product code are both available, so don't try to use those values before you check that they are available. - YowE3KWorksheets(.Range("F" & j))before you test whetherSheets("Order List").Range("F" & j) <> "". So if it is blank, you are looking for the worksheet with no name. Don't try to use the values before you check that they are available - move the calculation ofiinside theIfstatement where you will know that it will work. - YowE3KValueproperty is not used by default -.Range("F" & j)needs to be changed to.Range("F" & j).Valuewhen being used as an index to theWorksheetscollection. I'll update my answer accordingly. - YowE3K