Extracting just words with color letter

mariela

New Member
Joined
Jan 19, 2005
Messages
9
Hi, two days I'm trying to find solution to this problem:

I have table in Excel (2003, WinXP) with text
every cell contains a few words. Just one of the words have red letter.
I need to extract words containg the red letter and sort them by abc.
Sorting is not the problem but extracting.

In Microsoft forums one smart guy help me to extract the red letter with this code:

=ColorWord(A1,3)

to extract the red letters from cell A1.

HTH,
Bernie
MS Excel MVP


Function ColorWord(myCell As Range, iColor As Integer)
Dim i As Integer
ColorWord = ""
With myCell
For i = 1 To Len(myCell.Text)
With .Characters(i, 1).Font
If .ColorIndex = iColor Then
ColorWord = ColorWord & Mid(myCell.Text, i, 1)
End If
End With
Next i
End With
End Function


I tried to changed it and nothing worked.
What I need to be chaged here is - range from A1:D5000
and extracting the whole word.

Thanks in advance,

Mariela
 
Hi Mariela,

I'm afraid I'm not sure why you are getting that message! Is it a particular cell that is being looked at when the error message is appearing? From you saying its working it implies that it is bringing across some data onto Sheet 2 in the right format, so it must be a specific piece of data thats causing the error.

There might be a strange text string or something.

Richard
 
Upvote 0

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,215,219
Messages
6,123,683
Members
449,116
Latest member
HypnoFant

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top