View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default A further problem that I am struggling with

On Sat, 08 Aug 2009 22:59:18 -0400, Ron Rosenfeld
wrote:

Private Function TitlePos(s As String) As Long
Dim sTitles As Variant
Dim i As Long
sTitles = Array(" MRS ", " MR ", " MISS ")
For i = 0 To UBound(sTitles)
TitlePos = InStrRev(s, sTitles(i), -1, vbTextCompare)
If TitlePos 0 Then Exit For
Next i
End Function


This part should, more properly, be written as:

=======================
Private Function TitlePos(s As String) As Long
Dim sTitles As Variant
Dim i As Long
sTitles = Array(" MRS ", " MR ", " MISS ")
For i = LBound(sTitles) To UBound(sTitles)
TitlePos = InStrRev(s, sTitles(i), -1, vbTextCompare)
If TitlePos 0 Then Exit For
Next i
End Function
========================

--ron