filtering records based on fill colors possible?

wavemehello

Board Regular
Joined
Jan 24, 2006
Messages
221
hi there,
my worksheet contains staffnames and training completed/not completed which are indicated by different fill colors. If required, can I filter records based on the fill colors? If yes, how?

Thank you
Aj
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

wavemehello

Board Regular
Joined
Jan 24, 2006
Messages
221
I would highly appreciate if i could get a sample macro codes for example
names are in column A, training name in Column B, status in column C (this column has different fill colors)
 

agihcam

Well-known Member
Joined
Jan 16, 2006
Messages
1,624
sample code;
Code:
Sub test()
Dim i As Long
For i = Range("c" & Rows.Count).End(xlUp).Row To 2 Step -1
    If Cells(i, "c").Interior.Color <> vbRed Then
        Rows(i).EntireRow.Hidden = True
    End If
Next
End Sub
 

wavemehello

Board Regular
Joined
Jan 24, 2006
Messages
221

ADVERTISEMENT

sorry, where does this code go? Do I press Alt F11 then select this worksheet and paste code or create a command button and put the code in on click event? or does it fit somewhere within autofilter?
sorry 4 my ignorance!
 

agihcam

Well-known Member
Joined
Jan 16, 2006
Messages
1,624
hit Alt + F11, right click the vba project, insert module and paste the code there. close the vbe. then from Tools > macro > macros run the code.
 

wavemehello

Board Regular
Joined
Jan 24, 2006
Messages
221
red and green
red=failed training
green=passed the training
I put the pointer and filled the red /green color from the fill color toolbar
 

agihcam

Well-known Member
Joined
Jan 16, 2006
Messages
1,624
does red fill always "failed training" and green fill always "passed the training". if that should be the case, then you can use these cell value as a condition to hide rows.
 

Forum statistics

Threads
1,136,305
Messages
5,674,984
Members
419,541
Latest member
freddyboots

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