ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting text in cells & half of the Selected Text to be underLine (https://www.excelbanter.com/excel-programming/313132-selecting-text-cells-half-selected-text-underline.html)

Manish Singh

Selecting text in cells & half of the Selected Text to be underLine
 
Hai,

I am trying to figure this out that it there any code that would be
avaliable that can help to select the text in the defined cell & make
The half of the selected text to be undeline in a selected Cell ?


Bye
Manish Singh

Haldun Alay[_4_]

Selecting text in cells & half of the Selected Text to be underLine
 
Hi,

You need to use ActiveCell's Characters class. following macros will help you.

Sub FirstHalfUnderLineCell()
With ActiveCell
.Characters(Start:=1, Length:=WorksheetFunction.RoundUp(Len(.Value) / 2, _
0)).Font.Underline = xlUnderlineStyleSingle
End With
End Sub
Sub SecondHalfUnderLineCell()
With ActiveCell
.Characters(Start:=WorksheetFunction.RoundUp(Len(. Value) / 2, 0), _
Length:=(Len(.Value) - WorksheetFunction.RoundUp(Len(.Value) / 2, _
0) + 1)).Font.Underline = xlUnderlineStyleSingle
End With
End Sub

Kind Regards

--
Haldun Alay
"Manish Singh" , haber iletisinde sunlari . com...
Hai,

I am trying to figure this out that it there any code that would be
avaliable that can help to select the text in the defined cell & make
The half of the selected text to be undeline in a selected Cell ?


Bye
Manish Singh

Manish Singh

Selecting text in cells & half of the Selected Text to be underLine
 
Hi,

I tried the code u give but it's doen't help at all, is ther any way
as I am using the vb & I have to make the Text in the Cell(1,1) to be
let the text in the cell be is "Ref No: 23456" , where the 2456 is to
be underline while the Ref No remain the same as it is?


"Haldun Alay" wrote in message ...
Hi,

You need to use ActiveCell's Characters class. following macros will
help you.

Sub FirstHalfUnderLineCell()
With ActiveCell
.Characters(Start:=1,
Length:=WorksheetFunction.RoundUp(Len(.Value) / 2,
0)).Font.Underline = xlUnderlineStyleSingle
End With
End Sub
Sub SecondHalfUnderLineCell()
With ActiveCell
.Characters(Start:=WorksheetFunction.RoundUp(Len(. Value) / 2,
0),
Length:=(Len(.Value) -
WorksheetFunction.RoundUp(Len(.Value) / 2,
0) + 1)).Font.Underline = xlUnderlineStyleSingle
End With
End Sub

Kind Regards

--
Haldun Alay
"Manish Singh" <dost , haber iletisinde sunlari
. com...
Hai,

I am trying to figure this out that it there any code that would be
avaliable that can help to select the text in the defined cell & make
The half of the selected text to be undeline in a selected Cell ?


Bye
Manish Singh
--


Haldun Alay[_4_]

Selecting text in cells & half of the Selected Text to be underLine
 
Hi,

"Ref No: 23456"

Now it is more clear... Use this macro.

Sub UnderLineCell()
Const StartPos = 8 ' Length of "Ref No: "
With ActiveCell
.Characters(Start:=StartPos + 1, _
Length:=(Len( _
.Value) - StartPos)).Font _
.Underline = xlUnderlineStyleSingle
End With
End Sub

Kind regards.

--
Haldun Alay
"Manish Singh" , haber iletisinde sunlari . com...
Hi,

I tried the code u give but it's doen't help at all, is ther any way
as I am using the vb & I have to make the Text in the Cell(1,1) to be
let the text in the cell be is "Ref No: 23456" , where the 2456 is to
be underline while the Ref No remain the same as it is?


"Haldun Alay" wrote in message ...
Hi,

You need to use ActiveCell's Characters class. following macros will
help you.

Sub FirstHalfUnderLineCell()
With ActiveCell
.Characters(Start:=1,
Length:=WorksheetFunction.RoundUp(Len(.Value) / 2,
0)).Font.Underline = xlUnderlineStyleSingle
End With
End Sub
Sub SecondHalfUnderLineCell()
With ActiveCell
.Characters(Start:=WorksheetFunction.RoundUp(Len(. Value) / 2,
0),
Length:=(Len(.Value) -
WorksheetFunction.RoundUp(Len(.Value) / 2,
0) + 1)).Font.Underline = xlUnderlineStyleSingle
End With
End Sub

Kind Regards

--
Haldun Alay
"Manish Singh" <dost , haber iletisinde sunlari
. com...
Hai,

I am trying to figure this out that it there any code that would be
avaliable that can help to select the text in the defined cell & make
The half of the selected text to be undeline in a selected Cell ?


Bye
Manish Singh
--



All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com