Underline and Bold 4th numeral

S

Steved

Hello from Steved

all cells in column C

3547

How does one underline and bold the 4th numeral in this case 7 please.

Thankyou.
 
B

Bernie Deitrick

Steve,

If you can live with the cells formatted as strings:

Sub Macro1()
Dim myS As String
Dim myC As Range

For Each myC In Intersect(ActiveSheet.UsedRange, Range("C:C"))
myS = myC.Value
myC.NumberFormat = "@"
myC.Value = myS
With myC.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Underline = xlUnderlineStyleSingle
End With
Next myC
End Sub

Otherwise, the formatting won't take.

HTH,
Bernie
MS Excel MVP
 
P

Per Jessen

Hello Steved

Assuming you always want the 4th numeral bolded and underlined try
this:

Sub Test()
Application.ScreenUpdating = False
Columns("C").Select
For Each cell In Selection

With cell.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Underline = xlUnderlineStyleSingle
End With
Next
Application.ScreenUpdating = True
End Sub

Regards,
Per
 
S

Steved

Thankyou.

Per Jessen said:
Hello Steved

Assuming you always want the 4th numeral bolded and underlined try
this:

Sub Test()
Application.ScreenUpdating = False
Columns("C").Select
For Each cell In Selection

With cell.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Underline = xlUnderlineStyleSingle
End With
Next
Application.ScreenUpdating = True
End Sub

Regards,
Per
 
Top