VBA Colorindex Bring Back Header

anthonyexcel

Active Member
Joined
Jun 10, 2011
Messages
258
Office Version
  1. 365
Platform
  1. Windows
Good afternoon I have some cells that are colorindexed. I need to count those cells. The colorindexs are 5, 3, and 14. Please see below.
<title>Excel Jeanie HTML</title>Sheet1

*ABCD
1CourseWashingtonLincolnCenter
2ACCOUNTING I***
3ADMIN STUDY HALL***
4ADV BAND***
5ADVANCED DIGITAL IMAGING***
6ADVANCED DRAWING***
7ADVANCED PLAYWRITING***
8ADVANCED POTTERY***
9ADVANCED STUDIO ARTS***
10ALGEBRA I***
11ADVISORY***
12BIOLOGY***
13AE ENG 1***
14ENGLISH 1***
15ENGLISH 2***
16GEOMETRY***
17US HIST***

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:254px;"><col style="width:106px;"><col style="width:106px;"><col style="width:106px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

<input class="SYN_LNN" value="2" type="label"><input id="syn_ctrl2" class="SYN_BCH" role="button" value="-" type="label">


<input class="SYN_LNN" value="3" type="label"><input id="syn_ctrl3" class="SYN_BCH" role="button" value="-" type="label">





This is what I need
<title>Excel Jeanie HTML</title>Sheet1

*ABCDE
1CourseWashingtonLincolnCenterResults
2ACCOUNTING I***Lincoln, Center
3ADMIN STUDY HALL***Lincoln
4ADV BAND***Lincoln
5ADVANCED DIGITAL IMAGING***Washington, Lincoln, Center
6ADVANCED DRAWING***Lincoln
7ADVANCED PLAYWRITING***Lincoln
8ADVANCED POTTERY***Lincoln
9ADVANCED STUDIO ARTS***Lincoln
10ALGEBRA I***Washington
11ADVISORY***Lincoln
12BIOLOGY***Washington, Center
13AE ENG 1***Washington
14ENGLISH 1***Washington
15ENGLISH 2***Washington
16GEOMETRY***Washington
17US HIST***Washington, Center

<colgroup><col style="font-weight:bold; width:30px; "><col style="width:254px;"><col style="width:106px;"><col style="width:106px;"><col style="width:106px;"><col style="width:187px;"></colgroup><tbody>
</tbody>


Excel tables to the web >> Excel Jeanie HTML 4

<input class="SYN_LNN" value="2" type="label"><input id="syn_ctrl2" class="SYN_BCH" role="button" value="-" type="label">


<input class="SYN_LNN" value="3" type="label"><input id="syn_ctrl3" class="SYN_BCH" role="button" value="-" type="label">


Thanks in advance!
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Here is one way! Use it like this:
If header is in B1:D1 then in E2 put =CountingSchools($B$1:$D$1,B2:D2)

Code:
Function CountingSchools(Schools, r As Range)
    For Each cell In r
       If cell.Interior.ColorIndex = 3 Or cell.Interior.ColorIndex = 5 Or cell.Interior.ColorIndex = 14 Then
            CountingSchools = CountingSchools & " " & Cells(Schools.Row, cell.Column) & ", "
       End If
    Next cell
    CountingSchools = Left(CountingSchools, Len(CountingSchools) - 2)
End Function
 
Upvote 0
Sorry for getting back so late. It works perfect. Thanks you again for your help!
 
Upvote 0

Forum statistics

Threads
1,215,026
Messages
6,122,743
Members
449,094
Latest member
dsharae57

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