Identify and split Camel Text

Camel Text (CamelText) is best described as text where words that should be separated normally by a space have been pushed together and in every day data analysis need to be reconstructed. This only applies to text where a capital letter was used for each word such as in a title or a persons name for instance. The code analyses the string for a change in case of the letters and splits it out accordingly.

This example runs down a list or range of cells but can be setup as you require to cover an entire worksheet range or a single cell.

This code is used in most datanology database cleansing projects where data may have been merged or corrupted in some way. Contact us using the form or leave a message for assistance with your Excel project.



Private Sub CamelText

For Each cell In Range("A1:A100")
S = cell.Value
For x = Len(S) - 1 To 1 Step -1
If Mid(S, x, 2) Like "[a-z][A-Z]" Then S = Left(S, x) & " " & Mid(S, x + 1)
Next
cell.Value = S
Next

End Sub






Contact us for some advice and guidance on how your Excel development could be created and start helping your business straight away. Contact Us

Datanology