The copy and pasting is doing what I want, but I'm having trouble advancing to the next cell in the Quantity column, to repeat my copy and paste. Eventually (when I stumble through this problem) I will need to do the pasting of the data from my 'next c in range' to the next row on the Invoice sheet. One problem at a time though I suppose.
I'm also confused about the last few rows of code - if the cell is not >1 (i.e. it's blank) I want the code to move onto the next cell in the Quantity range, but if I put a 'Next c' between my Else... and End If, I get an error.
Any help is much appreciated.
I'm also confused about the last few rows of code - if the cell is not >1 (i.e. it's blank) I want the code to move onto the next cell in the Quantity range, but if I put a 'Next c' between my Else... and End If, I get an error.
Any help is much appreciated.
Code:
Worksheets("Job Card").Select
Dim Quantity As Range
Worksheets("Job Card").Range("Quantity").Select
For Each c In Range("Quantity") 'for each cell in the Quantity column
If ActiveCell > 0 Then 'check if the value is greater than 0, if so then...
ActiveCell.Select 'selects the Quantity
Application.CutCopyMode = False
Selection.Copy Sheets("Invoice").Range("A17") 'Copies Quantity to Invoice sheet
ActiveCell.Offset(0, -2).Select 'move two c to left & select Item from Job Card
Application.CutCopyMode = False
Selection.Copy Sheets("Invoice").Range("B17") 'Copies Item to Invoice sheet
ActiveCell.Offset(0, 3).Select 'move three c to right & select Total from Job Card
Application.CutCopyMode = False
Selection.Copy
Sheets("Invoice").Range("C17").PasteSpecial xlValues 'Copies Total to Price column of Invoice sheet
Else 'if Quantity is not >1
End If
Next c 'move to the next cell in Quantity Range