jamesbailey0
New Member
- Joined
- Apr 6, 2016
- Messages
- 7
Hi,
I am after a bit of code that can copy cells that contain unique values into new cells but in the same sheet.
In short I have a table that is produced by scanning items into the sheet, The barcode column (A) is populated by a scanner, which auto fills column B and C.
Column C displays a value either 1 or 2, code 1 is for products that are expected and code 2 is for products that are not expected. The list can be sometimes 200 lines long.
I am after a VBA code that can be run once the list is completed that pulls out all the products that are not expected, I.E products coded "2" in column C, and puts the Barcode and Description into column E and F - which will basically act as an error sheet that I can print off.
In the example below I want a code that can copy 1234987 and Grapes into E and F.
[TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[/TR]
[TR]
[TD]Barcode
[/TD]
[TD]Description
[/TD]
[TD]Ok?
[/TD]
[TD][/TD]
[TD]Error Bar
[/TD]
[TD]Error Desc
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1234567
[/TD]
[TD]Apples
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1215567
[/TD]
[TD]Pears
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1236548
[/TD]
[TD]Oranges
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1234987
[/TD]
[TD]Grapes
[/TD]
[TD]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance for the help.
I am after a bit of code that can copy cells that contain unique values into new cells but in the same sheet.
In short I have a table that is produced by scanning items into the sheet, The barcode column (A) is populated by a scanner, which auto fills column B and C.
Column C displays a value either 1 or 2, code 1 is for products that are expected and code 2 is for products that are not expected. The list can be sometimes 200 lines long.
I am after a VBA code that can be run once the list is completed that pulls out all the products that are not expected, I.E products coded "2" in column C, and puts the Barcode and Description into column E and F - which will basically act as an error sheet that I can print off.
In the example below I want a code that can copy 1234987 and Grapes into E and F.
[TABLE="width: 500"]
<tbody>[TR]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[TD]D
[/TD]
[TD]E
[/TD]
[TD]F
[/TD]
[TD]G
[/TD]
[TD]H
[/TD]
[TD]I
[/TD]
[TD]J
[/TD]
[/TR]
[TR]
[TD]Barcode
[/TD]
[TD]Description
[/TD]
[TD]Ok?
[/TD]
[TD][/TD]
[TD]Error Bar
[/TD]
[TD]Error Desc
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1234567
[/TD]
[TD]Apples
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1215567
[/TD]
[TD]Pears
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1236548
[/TD]
[TD]Oranges
[/TD]
[TD]1
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1234987
[/TD]
[TD]Grapes
[/TD]
[TD]2
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Thanks in advance for the help.