• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Search and Replace

Shay A

Member
Hi,
Is it possible to use this feature to be applied only on part of the text in a ceii?
For example,
if a cell contains the following: "Shay A" and I want Just "Shay" to be underlined and not the "A", i hope I am making myself clear...
TY!
 
Nebu is correct

Can you define a set of rules that tell us what you want underlined ?
eg: If you always want the first word underlined, use the following code:

Code:
Sub Underline_First_Word()

Dim LR As Integer, FS As Integer
Dim c As Range

LR = Range("A" & Rows.Count).End(xlUp).Row
For Each c In Range("A1:A" & LR)
  FS = InStr(1, c, " ")

  With c.Characters(Start:=1, Length:=FS - 1).Font
  '.Name = "Calibri"
  '.FontStyle = "Regular"
  '.Size = 11
  .Underline = xlUnderlineStyleSingle
  '.ThemeColor = xlThemeColorLight1
  '.TintAndShade = 0
  '.ThemeFont = xlThemeFontMinor
  End With
Next c

End Sub

I left the lines commented out as you can also change other aspects of the words
 
Back
Top