Spacing Macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
Im looking for a spacing macro that adds spaces based on Capitalization
changes. For example if I have : JhonDoeDeer, the macro will move it to
another cell as John Doe Deer. If anyone knows of a website that shows a
template for a macro like this, please let me know. Or if there is some way
to do this with clever excel equations, that would be great too. Thanks
again.
 
This worked for me in Excel 2000

Dim str As String, n As Integer, str2 As String
str = "AbCdE"
str2 = Left(str, 1)
For n = 2 To Len(str)
If Mid(str, n, 1) = UCase(Mid(str, n, 1)) Then
str2 = str2 & " " & Mid(str, n, 1)
Else: str2 = str2 & Mid(str, n, 1)
End If
Next
MsgBox str2
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top