Заменить:
cell.Value = UCase(Left(cell.Value, 1)) & Right(cell.Value, Len(cell.Value) - 1)
С:
comma = InStr(cell.Value, ",")
If comma <> 0 Then
cell.Value = Left(cell.Value, comma) & UCase(Mid(cell.Value, comma + 1, 1)) & Right(cell.Value, Len(cell.Value) - comma - 1)
End If
Он преобразует в верхний регистр букву после первой запятой в строке.
Если в ячейке несколько запятых, замените макрос следующим:
Sub TitleCase()
Dim rng As Range, cell As Range
Dim buffer() As String 'Creates an empty array
Set rng = Range("D4:D99")
For Each cell In rng
If (cell.Value <> "") Then
buffer = Split(StrConv(cell.Value, vbUnicode), Chr$(0)) 'split characters into array
ReDim Preserve buffer(UBound(buffer) - 1)
iscomma = False
changedstring = ""
For i = LBound(buffer) To UBound(buffer)
If iscomma = True Then
buffer(i) = UCase(buffer(i))
iscomma = False
End If
If buffer(i) = "," Then
iscomma = True
End If
changedstring = changedstring & buffer(i)
Next i
cell.Value = changedstring
End If
Next cell
End Sub