Macro to search blue font text in excel

cassie123

New Member
Joined
May 27, 2015
Messages
21
Hi all,

I am beginner on macro and I recently got a task from work.

I need a macro code to search cell that formatted in blue font and replace with value from another workbook.

I appreciate all the help and suggestion.

Thanks
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I found this. Not exactly what you are looking for, but might get your started.
Sub ColourCells()
Dim rngLook, rngC As Range
Dim i As Integer
Dim strNew As String
Set rngLook = Range("F21:F25")
For Each rngC In rngLook
If Left(rngC, 1) <> "=" And Len(rngC) > 0 Then
For i = 1 To Len(rngC)
Debug.Print Mid(rngC, i, 1) & " colour " & rngC.Characters(i, 1).Font.Color
Select Case Mid(rngC, i, 1) & rngC.Characters(i, 1).Font.Color
Case "G0"
strNew = strNew & "G"
Case "G255"
strNew = strNew & "g"
Case "G4626167"
strNew = strNew & "Gf"
Case "G65535"
strNew = strNew & "Gm"
End Select
Next i
rngC.Value = strNew
rngC.Font.Color = 0
End If
Next rngC

End Sub
 
Upvote 0
@cassie123,

Are you just wanting to do a Find (search string) and Replace with (a single string from other workbook) process and limit the Find to Cells that have been formatted to have Blue Font? If so, that's pretty easy to do manually by using the Find and Replace dialog (Ctrl-H) > Options > specify the formatting to be searched.

If you are doing something more complex like looking up multiple values from another workbook then please provide more details about what needs to be done.
 
Upvote 0
@cassie123,

Are you just wanting to do a Find (search string) and Replace with (a single string from other workbook) process and limit the Find to Cells that have been formatted to have Blue Font? If so, that's pretty easy to do manually by using the Find and Replace dialog (Ctrl-H) > Options > specify the formatting to be searched.

If you are doing something more complex like looking up multiple values from another workbook then please provide more details about what needs to be done.


However, when I can't seem to replace with the cell that from another workbook.
 
Upvote 0
I don't understand what you are trying to do. If you are just replacing one text value from another workbook, I'm suggesting you could just type that value into the Replace with: box.
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,257
Members
448,880
Latest member
aveternik

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