Displaying rows having one cell font color to different sheet.

jlokesh16

New Member
Joined
Jan 22, 2015
Messages
39
Hello,

I have 4 columns in sheet 1, in which the first column has cells whose font color is red.
I want to copy only those rows whose first column cell data has red font color to sheet 2.
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Assuming Sheet2 exists with nothing in it, try this. (Check exact sheet names)
If it is not what you want, please give more details.
Code:
Sub GetRed()
  With Sheets("Sheet1").UsedRange
    .AutoFilter Field:=1, Criteria1:=vbRed, Operator:=xlFilterFontColor
    .Copy Destination:=Sheets("Sheet2").Range("A1")
    .AutoFilter
  End With
End Sub
 
Last edited:
Upvote 0
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]Apt name[/TD]
[TD]Calls[/TD]
[TD]start time[/TD]
[TD]end time[/TD]
[/TR]
[TR]
[TD]ACH10P01[/TD]
[TD]2[/TD]
[TD]8/15/2018 11:51:49 AM[/TD]
[TD]8/15/2018 12:23:53 PM[/TD]
[/TR]
[TR]
[TD][TABLE="width: 77"]
<tbody>[TR]
[TD="class: xl66, width: 77"]ALD10P01[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 65"]
<tbody>[TR]
[TD="class: xl66, width: 65"]8[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 114"]
<tbody>[TR]
[TD="class: xl66, width: 114"]8/15/18 12:36 PM[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][TABLE="width: 114"]
<tbody>[TR]
[TD="class: xl66, width: 114"]8/15/18 9:27 PM[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]

Above is the table format i have.
In col A, there are cells having font color in red and black.
I want to only export the rows having red font color in col A to another sheet.

Expected display in other sheet should be as below

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]Apt Name[/TD]
[TD]Calls[/TD]
[TD]start time[/TD]
[TD]end time[/TD]
[/TR]
[TR]
[TD]ACH10P01[/TD]
[TD]2[/TD]
[TD]8/15/2018 11:51:49 AM[/TD]
[TD]8/15/2018 12:23:53 PM[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
That is exactly what the suggested code produced for me. In what way did it fail for you?
 
Upvote 0
it is only showing reference from col A, other three column data is not referenced.
Can you explain exactly what that means?

When I copied that data from the top table in post 3 to 'Sheet1' (cells A1:D3) in my test workbook and then ran the macro, 'Sheet2' (which was blank to start with) ended up exactly like the second table in post 3.
 
Upvote 0
I have assigned a button to the macro as "Export". When i click the button, only on column's data of single row is shown, data is there in almost 800 rows.
 
Upvote 0
Ok here is another sample of mine.


Book1
ABCD
1Apt nameCallsstart timeend time
2ACH10P0128/15/2018 11:51:49 AM8/15/2018 12:23:53 PM
3ALD10P0188/15/18 12:36 PM8/15/18 9:27 PM
4data 12Start time 3End time 3
5data 26Start time 4End time 4
6data 35Start time 5End time 5
7data 43Start time 6End time 6
8data 52Start time 7End time 7
9data 63Start time 8End time 8
10data 71Start time 9End time 9
11data 82Start time 10End time 10
12
Sheet1



Sheet2 is blank and I then run the macro I posted. My Sheet2 now looks like this:


Book1
ABCD
1Apt nameCallsstart timeend time
2ACH10P0128/15/2018 11:51:49 AM8/15/2018 12:23:53 PM
3data 12Start time 3End time 3
4data 26Start time 4End time 4
5data 63Start time 8End time 8
6data 71Start time 9End time 9
7data 82Start time 10End time 10
8
Sheet2


If it is not working for you, perhaps you could post a sample workbook to a public file-share site (eg Dropbox) & provide a link to that file so that we can see if there is something significantly different with your workbook compared to mine.
 
Upvote 0
It is working now, will this code run for blue and green color too, as i have few records whose font color is blue and green, how do i extract them in separate sheets.
 
Upvote 0
There are lots of different blues and greens (& reds) so you would need to identify the exact relevant colours and what sheet they should each go to. So the colours could be identified by a single number or as a RGB set. For example the one particular blue might be represented by the value 12611584 or as RGB(0, 112, 192)

Once we know the colours and the associated sheets we can construct the code.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

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