Private Sub Command1_Click() MsgBox UCaseFirstChar("qTTThis is a test") End Sub Public Function UCaseFirstChar(StringX As String) As String If VBA.Asc(VBA.Left(StringX, 1)) >= VBA.Asc("a") And VBA.Asc(VBA.Left(StringX, 1)) <= VBA.Asc("z") Then UCaseFirstChar = VBA.Replace(StringX, VBA.Left(StringX, 1), VBA.UCase(VBA.Left(StringX, 1)), , 1) Else UCaseFirstChar = StringX End If End Function
MsgBox UCaseFirstChar("qTTThis is a test")
End Sub
Public Function UCaseFirstChar(StringX As String) As String
If VBA.Asc(VBA.Left(StringX, 1)) >= VBA.Asc("a") And VBA.Asc(VBA.Left(StringX, 1)) <= VBA.Asc("z") Then
UCaseFirstChar = VBA.Replace(StringX, VBA.Left(StringX, 1), VBA.UCase(VBA.Left(StringX, 1)), , 1)
Else
UCaseFirstChar = StringX
End If
End Function