Inventory to Purchase order

[Closed]
Report
-
Posts
2818
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
October 18, 2021
-
Hello,

I have never ran a macro in Excel but did exactly this in Quatro Pro. . .I'd like to use a "inventory" tab with item #/Product Description/Qty/Price and then I want it to extract only the items with a quanity over to another tab "Purchase order".

Can someone please help?


1 reply

Posts
2818
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
October 18, 2021
486
Hi Tammy,

Try this code:
Sub Test()
Dim lRow, lRow2 As Integer
lRow = Sheets("Inventory").Range("A" & Rows.Count).End(xlUp).Row
For Each cell In Sheets("Inventory").Range("C2:C" & lRow)
If cell.Value > 0 Then
cell.EntireRow.Copy
lRow2 = Sheets("Purchase order").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Row
Sheets("Purchase order").Range("A" & lRow2).PasteSpecial
End If
Next cell
Application.CutCopyMode = False
End Sub

Best regards,
Trowa