ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formating column cells (https://www.excelbanter.com/excel-programming/287412-formating-column-cells.html)

Amjad

Formating column cells
 
I have a column full of single-word names. I want to
insert a dot (.) after every two consecutive letters. For
example if the name is: Amjad, then it will become:
Am.ja.d

Is there a quick way of doing that? like selecting the
whole column then format its contents in the manner
described above?

Thanks
Amjad


Rob van Gelder[_4_]

Formating column cells
 
Amjad,

Sub testit()
Const cInterval = 2
Dim rng As Range, strTemp As String, i As Long

With ActiveSheet
For Each rng In Range(.Cells(1, 1), .Cells(Rows.Count, 1).End(xlUp))
i = 1: strTemp = ""
Do Until i Len(rng.Value)
If i 1 Then strTemp = strTemp & "."
strTemp = strTemp & Mid(rng.Value, i, cInterval)
i = i + cInterval
Loop
Debug.Print strTemp
Next
End With
End Sub

Rob

"Amjad" wrote in message
...
I have a column full of single-word names. I want to
insert a dot (.) after every two consecutive letters. For
example if the name is: Amjad, then it will become:
Am.ja.d

Is there a quick way of doing that? like selecting the
whole column then format its contents in the manner
described above?

Thanks
Amjad





All times are GMT +1. The time now is 09:30 AM.

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