VBA code to move cells based on criteria

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.
A
B
C
D
E
F
G
H
I
J
Barcode
Description
Ok?
Error Bar
Error Desc
1234567
Apples
1
1215567
Pears
1
1236548
Oranges
1
1234987
Grapes
2

<tbody>
</tbody>


Thanks in advance for the help.
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Just to be clear, I don't want it to delete the error lines from the first list just copy them into the new columns.
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,013
Members
448,935
Latest member
ijat

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top