How to filter Excel sheets by color

happydz

New Member
Joined
Jan 11, 2017
Messages
46
Office Version
  1. 2010
Hi Guys
So I opened an Excel file and created a sheet1 solely for my Facebook groups, sheet2 for Facebook Friends, sheets3 for Facebook Pages that I'm a member in. In the Sheet4, I want to make it only for my Instagram account followers, Sheets5 for Instagram followings...etc and so on. The same strategy would be applied for my other social media account in the same Excel file.

In order for me to be able to organize these sheets, I made the sheets (1-2 and 3) that are related to my Facebook account in red color, the same thing for the others (4 and 5) in blue color...etc.
My question is there any way to filter the sheets based on their color, for example, when I choose color red, it displays only sheets that are related to my facebook account, when choosing the blue color it displays only my Instagram related sheets...
I know you guy want to tell me to create multiple excel files for every account, but I only want to gather all these accounts into one Excel file and name it "My Social Media Account Organization".
Thank you
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

I have assumed that you have a 'Master' sheet on which you have a cell to choose which sheets you want to see. Mine is cell A2 with Data Validation as shown.
Other than 'Master' (with no tab colour) I have tabs coloured with vbRed, vbBlue and vbGreen. If you need help with identifying the exact colours in your workbook post back.

1634529245294.png


happydz.xlsm
ABC
1Filter Sheetsall
2allfacebook
3instagram
4twitter
5
Master
Cells with Data Validation
CellAllowCriteria
A2:A3List=$C$1:$C$4


I have used this Worksheet_Change event code. To implement ..
1. Right click the 'Master' sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test by choosing values in A2 of 'Master'

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  Dim ws As Worksheet
  Dim clr As Long
  
  If Not Intersect(Target, Range("A2")) Is Nothing Then
    Select Case LCase(Range("A2").Value)
      Case "facebook": clr = vbRed
      Case "instagram": clr = vbBlue
      Case "twitter": clr = vbGreen
    End Select
    For Each ws In Worksheets
      If ws.Name <> "Master" Then ws.Visible = IIf(clr = 0, True, ws.Tab.Color = clr)
    Next ws
  End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

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