Is Name a defined name such as Insert=>Name=>Define or do you mean the
column has the word Name in the first row. This should handle both, but you
could remove what is not appropriate.
Dim rng as Range, cell as Range
Dim rng1 as Range
On Error Resume Next
set rng1 = Thisworkbook.Names("Name").RefersToRange
On Error goto 0
if rng1 is nothing then
for i = 1 to 256
if lcase(cells(1,i).Value) = "name" then
set rng1 = Cells(1,i).EntireColumn.Cells
exit for
End if
Next
End if
if rng1 is nothing then
msgbox "Can't find column"
Exit Sub
End if
On error resume next
set rng = ActiveSheet.Cells.SpecialCells(xlConstants,xlTextValues)
On Error goto 0
if not rng is nothing then
for each cell in rng
cell.Value = strConv(application.Trim(cell.Value),vbProperCase)
Next
Else
msgbox "No text values found"
End if
Proper and StrConv with the vbProperCase argument are not smart enough to
know capitalization rules for Names. The just capitalize the first letter
of each word.
I think you would need some type of dictionary that list all the unique
capitalizations or code the rules.