Thread: Underline
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default Underline

Arun

Try this macro.

Sub underline()
Dim v As Variant, i As Integer
If ActiveCell.HasFormula = False Then
v = Selection(1, 1).Value
For i = 1 To Len(v)
If Not (Mid(v, i, 1)) = Chr(32) Then
Selection(1, 1).Characters(Start:=i, _
Length:=1).Font.underline = True
End If
Next i
End If
End Sub


Gord Dibben MS Excel MVP

On Fri, 11 May 2007 21:13:00 -0700, Arun wrote:

I would like to apply underlining format to a cell where JUST the words are
underlined (the underlining does not extend accross the entire cell). It
seems that it always just underlined the word when I pressed Ctrl-U, but
lately Excel has been putting the underline accross the whole cell as if I
had added a border.