View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default how to turn automatically in CAPITALS parts of text in excel ?

One way:

Public Sub CapitalizeToHyphen()
Dim rCell As Range
Dim rToCheck As Range
Dim nPos As Long

On Error Resume Next
Set rToCheck = Selection.SpecialCells( _
xlCellTypeConstants, xlTextValues)
On Error GoTo 0
If rToCheck Is Nothing Then Exit Sub
For Each rCell In rToCheck
With rCell
nPos = InStr(.Text, "-")
If nPos 0 Then _
.Value = UCase$(Left$(.Text, nPos - 1)) & Mid(.Text, nPos)
End With
Next rCell
End Sub

In article . com,
wrote:

I have a huge catalogue of music (thousands of records) made in excel
where I have in the first cell the name of the band + album + format,
something like this:

Pearl Jam - name of the album - CD

how can I turn automatically all names of bands into CAPITALS, in
example:

PEAR JAM - name of the album - CD


Is there a way to run a script where it will turn in CAPITALS all text
from the beginning of a cell 'till the symbol ( - ) of each cell ?
(For a particluar column)