View Single Post
 
Old 06-22-2016, 06:29 PM
zhead zhead is offline Windows 7 64bit Office 2010 64bit
Advanced Beginner
 
Join Date: Mar 2015
Location: Texas
Posts: 32
zhead is on a distinguished road
Question How to Add a line of code to count highlighted cells

I have this code that works great. But i am trying to add a line of code to count the highlighted cells. This is what i have. The line in reads "Selection.AutoFilter 12, "Yellow" is what i am trying to add with no success.

Code:
Sub Macro24()
'
' Macro24 Macro
'

Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
    Select Case ws.Name
        Case Is = "OC", "APARNA", "OD", "REPORT", "QUERY", "SC", "SUMMARY", "MA"
            GoTo zz
        Case Else
            ws.Activate
                Cells.Select
                Selection.AutoFilter 8, "OPEN"
                Selection.AutoFilter 6, "*SYS*"
                Selection.AutoFilter 12, "Yellow"
                Selection.AutoFilter 21, "OC"
                Selection.AutoFilter 3, "<>*MOC*"
                Selection.AutoFilter 16, "<>*MOC*"
                Range("A2:BC" & Range("A" & Rows.Count).End(3).Row).SpecialCells(12).Copy Sheets("OC").Range("A" & Rows.Count).End(3)(2)
                ActiveSheet.AutoFilterMode = False
    End Select
zz:
Next ws
End Sub
Reply With Quote