Split Uppercase words in Excel

前端 未结 6 1495
花落未央
花落未央 2020-12-15 19:48

I would like to split all words in my cell by Uppercase, an example:

Original values:

MikeJones
RinaJonesJunior
MichealSamuelsLurth

6条回答
  •  眼角桃花
    2020-12-15 20:12

    Having acknowledged Excellll's remarkable formula, the most efficient code solution would be RegExp based. This avoids long loops.

    enter image description here

    Function SplitCaps(strIn As String) As String
    Dim objRegex As Object
    Set objRegex = CreateObject("vbscript.regexp")
    With objRegex
        .Global = True
        .Pattern = "([a-z])([A-Z])"
        SplitCaps = .Replace(strIn, "$1 $2")
    End With
    End Function
    

提交回复
热议问题