write at exceltoexplore@gmail.com : Report Automation|Dashboard in Excel| Provide Excel consulting through macro (VBA) automation |Financial Modeling | Ethical Hacking

Monday 14 May 2012

Excel : Count Number of Cells Colour in Row

Try below code to count the rowwise number of colour cells.
i have hardcode the column value. even comment (A macro comment is a piece of text in a macro which will not be executed by Excel VBA. It is only there to provide you information about the macro)
the lines which provide the last column

the person from this requirement came she used to count the colour rows manually. in actual file there are around 191 columns day wise & rows contain employee names. its hours of work with this code now in fraction of second.





Sub Mtest()
Dim countcolor As Long, ColorCount As Long
Dim i As Long, LC As Long
'LC = Cells(3, Columns.Count).End(xlToLeft).Column
'change row here
For i = 3 To Sheet1.Cells(Rows.Count, "C").End(xlUp).Row
ColorCount = 0
For Each c In Range(Cells(i, 5), Cells(i, 191)) 'change column count here
'For Each c In Range(Cells(i, 5), Cells(i, LC)) 'change column count here
If c.Interior.ColorIndex = 3 Then ColorCount = ColorCount + 1
Next c
countcolor = ColorCount
Cells(i, 191).Offset(0, 2).Value = countcolor
'Cells(i, LC).Offset(0, 1).Value = countcolor
Next i
End Sub


I have taken Red colour in above example .(Interior.ColorIndex = 3)
Excel Color Palette has an index of 56 colors which can be modified using VBA. Each color in the palette is associated with a unique value in the index that can be changed programatically. At times it is useful to know the relative positioning of the various colors within this index as well as how various versions of Excel treat colors


1 comment:

  1. RECOVERY OF LOST FUNDS (BINARY OPTIONS, BITCOINS, LOAN SCAM).
    THINGS YOU NEED TO KNOW ABOUT THE GLOBALKOS HACKS RECOVERY COMPANY.
    (leroysteckler@gmail.com)
    ⏱️2MIN.
    Hiring a professional hacker has been one of the world most technical valued navigating information. High prolific information and Privileges comes rare as it has been understood that what people do not see, they will never know.
    Welcome to the Global KOS hacking agency where every request concerning lost funds are recovered within a short period of time.
    The crucial benefit of contacting The Global-KOS hackers is
    • ZERO TRACES: When a hack is accomplished by us, no tracking base method will be used to trace any of our hacks to our clients or our organization because we use a strong proxy firewall switching and a firm security system to prevent unauthorized bodies from tracking or modifying our network accessible resources. I.e the hacker and clients are 100% safe and anonymous. Secondly,
    ADVANTAGE TO CLIENTS:
    • REPEAT CLIENTS and SERVICES: E.g, after helping a client recover all money lost to fraudulent practices, most of this clients comes back requesting we provide the same service in disguise as another person. We found a way to issue serial Numbers to each clients who seeks our help and services for identification purposes because we are not interested in your names nor location. But we urge that individuals shouldn't abuse this opportunities as we have provided value to you.
    However, when you wonder “which hacking company should I hire, the crucial aspect that should concern you is swift response. Clearly, you want to embark for services that provide swift responses. It's takes a test to find out our service imply precision and action.
    On this platform of recovery, you will be assigned to a designated professional hacker who is systematically known for operating on a dark web protocol. The operation of these hackers is to potentially deploy a distinguished cyber security technique to retrieving back the victims stolen funds via the application of a diverse intercall XX breacher which enables you to track the data location of a scammer. And extract every informations on the con database. Every information required by the Global KOS would be used to make this trace to navigate into every transaction, time and location of the scammer. This is achieved using the systematic courier tracking method.
    Which of the uneasy financial situation do you find youreslf in right now?
    ✅(BITCOIN INVESTMENTS, BINARY OPTIONS AND LOAN SCAM?
    This shocking study points to one harsh reality we all face today. It saddens our mind when a client expresses annoyance or dissatisfaction of unethical behaviors of scammers. We have striven to make tenacious efforts to help those who are victims of this fleas get off their traumatic feeling of loss.
    Our strength is based on the ability to help fix cyber problems by bringing together active cyber professionals in the GlobalkOS to work with.
    For prolific services and info,
    Contact:
    ✉️Email: theglobalkos@gmail.com
    leroysteckler@gmail.com
    ®Global KOS™
    2020.


    ReplyDelete