Inventory to Purchase order

Closed
Tammy - Feb 23, 2012 at 01:56 PM
TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
- Feb 28, 2012 at 09:05 AM
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

TrowaD
Posts
2880
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
May 2, 2022
509
Feb 28, 2012 at 09:05 AM
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
0