Forum Discussion
MARK JENKINS
Apr 26, 2018Copper Contributor
making a list from different tabs within an excel sheet based on the colour of the cell
I want to make a list based on the colour of the cell from different tabs within an excel sheet. How do I do this?
2 Replies
- Matt MickleBronze Contributor
Just wanted to follow up and see if you had resolved your issue?
- Matt MickleBronze Contributor
You can use a macro to get the result you would like, otherwise I don't think it's possible. Please see attached example workbook. Since, I cannot attach a macro enabled file you will need to paste this code into a new code module by doing the following:
1. Use Alt + F11 to access the Visual Basic Editor
2. Click Insert > Module
3. Paste this code into the "blank" window
4. Hit the "Play" button (Green Triangle on the task bar) to run the macro
Sub GetColorsAndList() Dim sht As Worksheet Dim Counter As Integer 'Cycle through worksheets For Each sht In ActiveWorkbook.Worksheets If sht.Name <> "Results" Then 'Get the color of Cell A1 and Print to Results Worksheet 'Using Copy and Paste ---> Change the cell reference as needed sht.Range("A1").Copy Sheets("Results").Range("A" & Counter + 1) 'Put the parent sheet in the cell on Results tab Sheets("Results").Range("A" & Counter + 1) = sht.Name Counter = Counter + 1 End If Next sht End SubThe results will look like this: