Formating column cells

  • Thread starter Thread starter Amjad
  • Start date Start date
A

Amjad

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
 
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
 
Back
Top