Excel VBA - Check/Format String
Dim cell As Range
Dim iPos As Long
For Each cell In Selection
iPos = InStr(cell.Value, ",")
If iPos 0 Then
cell.Value = Left(cell.Value, iPos) & _
UCase(Mid(cell.Value, iPos + 1, 1)) & _
Right(cell.Value, Len(cell.Value) - iPos -
1)
End If
Next cell
--
HTH
RP
(remove nothere from the email address if mailing direct)
"magix" wrote in message
...
Hi,
I would like to check and format string from a cell if a condition is met,
via using macro button.
Condition: if there is apostrophe in that string, the following letter
after apostrophe must be lowercase. if the following letter is a space,
then
nothing happen.
Of course, if I select multiple cells, it will check each of them.
Thanks in advance.
Regards,
Magix
|