Public Sub subReformatCellValues()
Dim i As Integer
Dim rngSelected As Range
Dim rng As Range
ActiveWorkbook.Save
On Error Resume Next
Set rngSelected = Application.InputBox(Title:="Reformatting cell values.", _
Prompt:="Select the range of cells to reformat.", Type:=8)
On Error GoTo 0
If rngSelected Is Nothing Then
Exit Sub
End If
For Each rng In rngSelected.Cells
For i = 1 To Len(rng)
If rng.Characters(i, 1).Font.Color = RGB(255, 0, 0) Then
rng.Characters(i, 1).Font.Underline = True
rng.Characters(i, 1).Font.Bold = True
End If
Next i
Next rng
End Sub
Option Explicit
Sub Change_Format()
Dim ws As Worksheet
Set ws = Worksheets("Sheet2") '<~~ *** Change to actual sheet name ***
Dim c As Range, i As Long
For Each c In ws.Range("A1").CurrentRegion '<~~ *** Change range to actual range ***
For i = 1 To Len(c)
If c.Characters(i, 1).Font.Color = vbRed Then
With c.Characters(i, 1)
.Font.Bold = True
.Font.Underline = True
End With
End If
Next i
Next c
End Sub
Hi Herakles,Welcome to Mr Excel.
This code will ask you to select the range and then make the changes that you need to all cells in that range.
It assumes a particular colour red.
If it does not work then we need to find out what colour red is being used.
VBA Code:Public Sub subReformatCellValues() Dim i As Integer Dim rngSelected As Range Dim rng As Range ActiveWorkbook.Save On Error Resume Next Set rngSelected = Application.InputBox(Title:="Reformatting cell values.", _ Prompt:="Select the range of cells to reformat.", Type:=8) On Error GoTo 0 If rngSelected Is Nothing Then Exit Sub End If For Each rng In rngSelected.Cells For i = 1 To Len(rng) If rng.Characters(i, 1).Font.Color = RGB(255, 0, 0) Then rng.Characters(i, 1).Font.Underline = True rng.Characters(i, 1).Font.Bold = True End If Next i Next rng End Sub
Hi,