Copy and paste data based on cell color

Steves73

Board Regular
Joined
Oct 19, 2016
Messages
173
Office Version
  1. 365
Platform
  1. Windows
Hi Guys<o:p></o:p>
I am Looking for amacro that copies and paste data based on cell color<o:p></o:p>
The macro searchesrows in sheet 1 for highlighted cells (Color Index 3,4,6,8)<o:p></o:p>
If a cell is highlightedwith any of the above color index, it copies data from column A and B and Row 1pastes to Sheet 2 starting at A1, next blank row<o:p></o:p>
Please see examplebelow<o:p></o:p>
Sheet 1<o:p></o:p>
A<o:p></o:p>
B<o:p></o:p>
C<o:p></o:p>
D<o:p></o:p>
E<o:p></o:p>
F<o:p></o:p>
G<o:p></o:p>
H<o:p></o:p>
1<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
1-Mar<o:p></o:p>
2-Mar<o:p></o:p>
3-Mar<o:p></o:p>
4-Mar<o:p></o:p>
5-Mar<o:p></o:p>
6-Mar<o:p></o:p>
2<o:p></o:p>
Peter<o:p></o:p>
1<o:p></o:p>
34<o:p></o:p>
91<o:p></o:p>
148<o:p></o:p>
205<o:p></o:p>
262<o:p></o:p>
319<o:p></o:p>
3<o:p></o:p>
Paul<o:p></o:p>
2<o:p></o:p>
56<o:p></o:p>
113<o:p></o:p>
170<o:p></o:p>
227<o:p></o:p>
284<o:p></o:p>
341<o:p></o:p>
4<o:p></o:p>
Bill<o:p></o:p>
3<o:p></o:p>
67<o:p></o:p>
124<o:p></o:p>
181<o:p></o:p>
238<o:p></o:p>
295<o:p></o:p>
352<o:p></o:p>
5<o:p></o:p>
Greg<o:p></o:p>
4<o:p></o:p>
21<o:p></o:p>
78<o:p></o:p>
135<o:p></o:p>
192<o:p></o:p>
249<o:p></o:p>
306<o:p></o:p>
6<o:p></o:p>
Ian<o:p></o:p>
5<o:p></o:p>
3<o:p></o:p>
60<o:p></o:p>
117<o:p></o:p>
174<o:p></o:p>
231<o:p></o:p>
288<o:p></o:p>
7<o:p></o:p>
Gary<o:p></o:p>
6<o:p></o:p>
78<o:p></o:p>
135<o:p></o:p>
192<o:p></o:p>
249<o:p></o:p>
306<o:p></o:p>
363<o:p></o:p>
8<o:p></o:p>
Simon<o:p></o:p>
7<o:p></o:p>
90<o:p></o:p>
147<o:p></o:p>
204<o:p></o:p>
261<o:p></o:p>
318<o:p></o:p>
375<o:p></o:p>
Sheet 2<o:p></o:p>
A<o:p></o:p>
B<o:p></o:p>
C<o:p></o:p>
D<o:p></o:p>
E<o:p></o:p>
F<o:p></o:p>
G<o:p></o:p>
H<o:p></o:p>
1<o:p></o:p>
Bill<o:p></o:p>
3<o:p></o:p>
3-Mar<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
2<o:p></o:p>
Greg<o:p></o:p>
4<o:p></o:p>
4-Mar<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
3<o:p></o:p>
Ian<o:p></o:p>
5<o:p></o:p>
1-Mar<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
4<o:p></o:p>
Simon<o:p></o:p>
7<o:p></o:p>
6-Mar<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
5<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
6<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
7<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
8<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
<tbody> </tbody>
<o:p>

</o:p>
 
=IF(ISERROR(VLOOKUP(A11,Sheet1!$A$4:$E$23,5,FALSE)),"",VLOOKUP(A11,Sheet1!$A$4:$E$23,5,FALSE))
 
Upvote 0

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hi Mate

Got it sorted, there was something in the spread sheet stopping the code, re did the sheet on a new workbook, all working perfectly now.

Thank you very much for all your help
 
Upvote 0

Forum statistics

Threads
1,215,444
Messages
6,124,893
Members
449,194
Latest member
JayEggleton

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