Help on macro – Filtering a table into other sheet

solracesoj

Board Regular
Joined
Oct 25, 2002
Messages
144
I’ve a table in Sheet1 in witch the cells have text in different colours (black, red, blue and pink). I want to make the table appear in sheet2 but only showing the cells in wich the text is red or pink.

Is this possible?

Thanks!


J.C.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Re: Help on macro – Filtering a table into other s

Hello,

Does this code suit your needs?

Code:
Sub RED_PINK_ONLY()
    Range("D3:G5").Select
    Selection.Copy
    Sheets("Sheet3").Select
    Range("D3").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    For Each CELL In Selection
        If CELL.Font.ColorIndex <> 38 And CELL.Font.ColorIndex <> 3 Then
            CELL.Clear
        End If
    Next CELL
End Sub

Youe will need to change the cell refs and colorindex numbers to suit.
 

solracesoj

Board Regular
Joined
Oct 25, 2002
Messages
144
Re: Help on macro &#8211; Filtering a table into other s

Tanks for the reply,

The code suited my needs! I just have a question: How can I know the code number for other colours?

I’ve notice that you used the numbers 38 and 3 for the colours pink and red, but if I want to use other colours where can I see there code numbers?

J.C.
 

onlyadrafter

Well-known Member
Joined
Aug 19, 2003
Messages
5,703
Platform
  1. Windows
Re: Help on macro &#8211; Filtering a table into other s

Hello,

use the MACRO recorder and change the text colour of a cell, go through all the colours you require, go to the VB window and the code will have been created. You just have to remember which order you selected them.

OK?
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,159
Messages
5,768,525
Members
425,480
Latest member
br400821

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
Top