Cell Toggle to Show and Hide Rows in the Active Sheet

kkorp

New Member
Joined
Feb 10, 2023
Messages
16
Office Version
  1. 2016
Platform
  1. Windows
Hello all, New Guy Here
I hoping to get some feed back here on a spreadsheet that I use to track an outside consultant remote installation of current software and new programs. I use a Legend as a guide line for the order of importance. (See Graphic) The first column is used for the group color. I'm not sure if its possible the use the colored cell as a toggle to show / hide the rows in the spreadsheet. I would like to be able too Click on to cell to show the colored rows and a second click to hide that content, just like a toggle.

Any help or thoughts would be greatly appreciated.

Thanks

1682027606972.png


1682027865438.png
 

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.
Where are they located?
Meaning, Legend and data are on the same sheet? if so, On what row the data starts? And is the data start from column A?
 
Upvote 0
The Legend is on the same sheet, Data starts on row 11 and ends on row 140 column A
 
Upvote 0
The Legends is on the same sheet and the cells colors start at B3 go to B8. It would nice if there was a way to add/remove more on the fly if possible. The Data starts on row 11 and ends on row 140 column A
 
Upvote 0
If you are familiar with VBAs, try this code on sheet level. If you are not familiar, let me know and I try to help you navigate through it.

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column = 2 And Target.Row >= 3 And Target.Row <= 8 Then 'Legend range: second column and rows between 3-8
        lr = Range("A:A").Find(What:="*", After:=Range("a1"), LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        For i = 11 To lr 'Data starting row
            If Cells(Target.Row, 1).Interior.Color = Cells(i, 1).Interior.Color Then
                Cells(i, 1).EntireRow.Hidden = Not Cells(i, 1).EntireRow.Hidden
            End If
        Next i
        Range("D1").Select
    End If
End Sub
 
Upvote 0
And if you add/remove items to the list just update the following parts of the code:
Rich (BB code):
If Target.Column = 2 And Target.Row >= 3 And Target.Row <= 8 Then
and

Rich (BB code):
For i = 11 To lr
 
Upvote 0
I pasted the code in the Sheet1 under VBAProject area, Ran it but Nothing happened
 
Upvote 0
I click on each cell that was colored, from B3 thru B8.

Nothing happened
 
Upvote 0

Forum statistics

Threads
1,223,895
Messages
6,175,257
Members
452,625
Latest member
saadat28

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