Forum Discussion
Counting specific shapes and colors
I have a spreadsheet that among text data, has shapes. These shapes are all circles and are filled with five different colors. What I am attempting to do is find out a way to have excel count the number of circles of a specific color (e.g. # of red circles, # of blue circles, ect.). I'm envisioning some sort of formula, likely a UDF from what I have found.
If it is not possible for excel to differentiate between two circles of different colors, then would it be possible for excel to count specific shapes. For example, instead of five different colored circles, could it count the number of circles, squares, triangles, diamonds, and hexagons?
All I have found so far is a way to count the total number of shapes in a spreadsheet via a UDF. I really hope there is a way to do what I described above. Thank you.
2 Replies
- NikolinoDEPlatinum Contributor
Is it not possible to count all shapes that have the same name with the name description?
..just a thought :).
untested...
Option Explicit Sub countnameshape() Dim intAnzahl As Integer, sh As Shape For Each sh In ActiveSheet.Shapes If sh.Name Like "Shape*" Then intAnzahl = intAnzahl + 1 Next Debug.Print intAnzahl End SubIf it's not what you're looking for, please just ignore it :).
I know I don't know anything (Socrates)
- khoughtonCopper Contributor
NikolinoDE Thanks for the reply. I'll try what you posted.