Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 740
Default calling for help again for xls 2003

Hello to all,

I got a mystical problem in tracking the bulk of continuous changes made in
a monitoring worksheet.

I need to count the number of cells in a worksheet that contains a specific
color of text.

e.g
In A1 contains text like this "The quick brown fox jumps over the lazy dog."

if the text "lazy dog" is colored red while the others are in black or blue
or whatever,
is it possible to count A1 as part of the cells that has red text in it...by
macro.?

I hope that this is possible, otherwise I am caught in a big mess counting
with my fingers these cells with red text in a group of text along thousands
of cells.

thanks for any advice or suggestion.
--
regards,

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 146
Default calling for help again for xls 2003

Try this out :) I've tested it and it worked for me, you might need to change
the If check for the colour, as I was going off the colour index 3 which is a
bright red. Unsure about that.

Sub CountInstancesOfRed()
Dim count As Integer
Dim i As Integer
Dim strLen As Integer
Dim aRange As Range
Set aRange = Sheet1.Range("A1:A10")
For Each c In aRange
strLen = Len(c.Value)
For i = 1 To strLen
With c.Characters(Start:=i, Length:=1).Font
If .ColorIndex = 3 Then
count = count + 1
Exit For
End If
End With
Next i
Next c
MsgBox count
End Sub

"driller" wrote:

Hello to all,

I got a mystical problem in tracking the bulk of continuous changes made in
a monitoring worksheet.

I need to count the number of cells in a worksheet that contains a specific
color of text.

e.g
In A1 contains text like this "The quick brown fox jumps over the lazy dog."

if the text "lazy dog" is colored red while the others are in black or blue
or whatever,
is it possible to count A1 as part of the cells that has red text in it...by
macro.?

I hope that this is possible, otherwise I am caught in a big mess counting
with my fingers these cells with red text in a group of text along thousands
of cells.

thanks for any advice or suggestion.
--
regards,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 740
Default calling for help again for xls 2003

tnaks and sorry for a late reply,

i've tested the macro, the pop-up result always shows a "0".

I may have missed something.

--
regards,



"NateBuckley" wrote:

Try this out :) I've tested it and it worked for me, you might need to change
the If check for the colour, as I was going off the colour index 3 which is a
bright red. Unsure about that.

Sub CountInstancesOfRed()
Dim count As Integer
Dim i As Integer
Dim strLen As Integer
Dim aRange As Range
Set aRange = Sheet1.Range("A1:A10")
For Each c In aRange
strLen = Len(c.Value)
For i = 1 To strLen
With c.Characters(Start:=i, Length:=1).Font
If .ColorIndex = 3 Then
count = count + 1
Exit For
End If
End With
Next i
Next c
MsgBox count
End Sub

"driller" wrote:

Hello to all,

I got a mystical problem in tracking the bulk of continuous changes made in
a monitoring worksheet.

I need to count the number of cells in a worksheet that contains a specific
color of text.

e.g
In A1 contains text like this "The quick brown fox jumps over the lazy dog."

if the text "lazy dog" is colored red while the others are in black or blue
or whatever,
is it possible to count A1 as part of the cells that has red text in it...by
macro.?

I hope that this is possible, otherwise I am caught in a big mess counting
with my fingers these cells with red text in a group of text along thousands
of cells.

thanks for any advice or suggestion.
--
regards,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calling a sub BOBODD Excel Programming 1 November 28th 06 10:21 PM
Excel 2003 VBA calling VB.NET ? Okiebug Excel Programming 2 November 28th 06 01:02 PM
Calling functions developed in VSTO 2005 from Office Excel 2003 Neil Janabi Excel Programming 0 March 16th 06 10:50 AM
Calling Solver from an Excel 2003 Macro expatgr Excel Programming 1 August 19th 04 01:18 PM
Calling from C#.Net App Office._CommandBarButton.Execute() method in Excel 2003 throws a COMException Jacek Excel Programming 1 December 21st 03 03:48 PM


All times are GMT +1. The time now is 03:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"