View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default If..The Statement to automatically format a name

On Sun, 8 Nov 2009 15:55:01 -0800, Gary''s Student
wrote:

Select the cells you want to fix and run this small macro:

Sub AddADot()
For Each r In Selection
s = Split(r.Value, " ")
If UBound(s) = 2 Then
If Len(s(1)) = 1 Then
s(1) = s(1) & "."
r.Value = Join(s, " ")
End If
End If
Next
End Sub


Of course, for a name like:

H J Smith

or

J Gimper

Your routine doesn't work.
--ron