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

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
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.
 
Upvote 0
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.
 
Upvote 0
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?
 
Upvote 0

Forum statistics

Threads
1,214,534
Messages
6,120,084
Members
448,943
Latest member
sharmarick

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