' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ' Copyright (c) 2001 James P. MacLennan All Rights Reserved ' Questions? Comments? Suggestions? Let me know ... www.cazh1.com ' This program is free software; you can redistribute it and/or modify ' it under the terms of the GNU General Public License as published by ' the Free Software Foundation; either version 2 of the License, or ' (at your option) any later version. ' ' This program is distributed in the hope that it will be useful, ' but WITHOUT ANY WARRANTY; without even the implied warranty of ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' GNU General Public License for more details. ' ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- Sub SetSortName() ' Set up a custom Resource View called My Resource Entry ' We use the Text2 field for sorting the list of names ' 02/14/2004 jpm - First version, assumes all Resources are People - we grab the last name, capitalize it, and ' stuff it in Text2 - then automatically sort by Text 2. Note the lack of error checking ... Dim R As Resources Dim i, j As Integer Set R = ActiveProject.Resources ' Loop thru the resources, set Text2 = Last Name ALL CAPS, Text3 = LastName For i = 1 To R.Count R(i).Name = Trim(R(i).Name) ' Clean up the name j = Len(R(i).Name) - InStrRev(R(i).Name, " ") ' Get last " " in the name - that's b4 the last name R(i).Text2 = UCase(Right$(R(i).Name, j)) ' Hack off the early stuff, force all caps R(i).Text3 = Right$(R(i).Name, j) ' Hack off the early stuff Next i ' Might as well sort the list for 'em Sort Key1:="Text2", Renumber:=True End Sub