Extract all cells with red font colour

I've already got a macro that returns the names of folders and the documents within them into Excel in a hierarchical type structure. The document names are returned in red text and I now need a script that copies the red text only and paste them into column A of sheet 2. Has anyone got any suggestions? I just can't get my head round how to do this.
x5225642Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mohammed RahmanCommented:
Start recording macro..apply filter to the first row..filter data by color (red text).. Select first red text cell..hold ctrl+shift and press down arrow to select data in entire column, ctrl+c to copy..go to sheer 2..select the cell and press ctrl+v to paste entite ref text data. Stop recording macro..press alt+f11 to open developer view and there you will have the script (macro). If the red text spans multiple columns, while holding shift+ctrl, press down arrow once and then right arrow once. This will always select the entire red text, itrespective of number of rows and columns (which can vary time to time)
0
MlandaTCommented:
Try this:
Dim ws As Worksheet
Set ws = Sheets("sheet1")

Dim ws2 As Worksheet
Set ws2 = Sheets("Sheet2")

Dim i As Integer, ws2row As Integer
i = 1
ws2row = 1

Do Until i = ws.UsedRange.Rows.Count

    If ws.Range("A" & i).Font.Color = RGB(255, 0, 0) Then
           ws2.Range("A" & ws2row).Value = ws.Range("A" & i).Value
           ws2row = ws2row + 1
    End If
    i = i + 1

Loop

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Roy CoxGroup Finance ManagerCommented:
If you are using one of the newer versions of Excel the best way is to Filter by Color

Option Explicit

Sub FilterRed()

    If Not ActiveSheet.AutoFilterMode Then ActiveSheet.Range("A1").AutoFilter
    
    ActiveSheet.Range("$A1").CurrentRegion.AutoFilter Field:=1, Criteria1:=RGB(255, 0 _
        , 0), Operator:=xlFilterCellColor
End Sub

Open in new window

1
Wayne Taylor (webtubbs)Commented:
It might even be a good idea to modify the original routine to place the document names in Sheet2 while they are being retrieved. If you could post that routine we can show you how to modify it.
0
Martin LissOlder than dirtCommented:
I've requested that this question be closed as follows:

Accepted answer: 250 points for mody2579's comment #a41009306
Assisted answer: 250 points for MlandaT's comment #a41009307

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.