View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Aposto Aposto is offline
external usenet poster
 
Posts: 7
Default Macro to insert a period for single characters in a string


Thanks works like a charm!

"Jacob Skaria" wrote:

With your names in ColA; try the below macro

Sub Macro()
lngLastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
For lngRow = 1 To lngLastRow
arrData = Split(Range("A" & lngRow), " ")
For intTemp = 0 To UBound(arrData)
If Len(arrData(intTemp)) = 1 Then
arrData(intTemp) = arrData(intTemp) & "."
End If
Next
Range("A" & lngRow) = Join(arrData, " ")
Next
End Sub

If this post helps click Yes
---------------
Jacob Skaria


"Aposto" wrote:

I want a macro to insert a peroid after any single alpha character in a list
of names in a column. I have a list of names but single alpha characters such
as middle initials don't have a period after it. Can this be done?