View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default 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