Underline and Bold 4th numeral

  • Thread starter Thread starter Steved
  • Start date Start date
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.
 
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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top