hey guys, im trying count the number of cells that have blue text (color index 5) inside of them, and then show the amount in (B2), but for the life of me i cant figure this out...help!!!
thanks
shy
hey guys, im trying count the number of cells that have blue text (color index 5) inside of them, and then show the amount in (B2), but for the life of me i cant figure this out...help!!!
thanks
shy
Place this code in a Standard module
In B2 typePlease Login or Register to view this content.
=bluecount(A1:G10)
Replace A1:G10 with the range you have used
Last edited by royUK; 12-10-2009 at 03:28 PM.
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
Hello shy07014,
Since you didn't say if you were counting cells that all the text was blue or not, this macro will count either a cell whose text all matches the color index you are looking for, or if the cell contains one or more characters with that same color index. Like Roy's macro, this too can be used as worksheet formula.
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Star below the post.3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
they are both great, except in Leith Ross's how can i change the color value if ui wanted to? also, if i wanted to put this code in a commandbutton, how would i accomplish this?
thanks again
Hello shy07014,
To add either code to a CommandButton requires changing the code to either look at the current cells selected or examine the used cells on the worksheet. Which do you want to do?
all the used cell in the spreadsheet, please.
thanks
Hello shy07014,
You will need to either attach the macro to the button if it is a Forms type button or place a call the macro in the Click event of the button if it is a Control Toolbox button.
Example using Roy's Code
Please Login or Register to view this content.
ok, i tried this:
however it returns a compile error: "function call on left hand side of assignment must return variant or objectPlease Login or Register to view this content.
Try this bit more extream but works perfectly
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks