Apologies if this sin't formatted correctly as it's my first post...
basically I have a 1539 cells each with a list of various subjects. A typical example is; Children's poetry,Children's songs,ChildrenSocial classesBlasphemyRidicule
Is there a macro I can use to automatically insert a comma before each capital so the cell would be; Children's poetry,Children's songs,Children,Social classes,Blasphemy,Ridicule
Or any quicker way than me going through each cell and manually adding a comma.
Re: Adding in a comma before every capital letter?
Good afternoon danc1994
Try this - it's a UDF rather than a macro but it should work OK for your needs.
Function InsComma(UText As String) As String
Dim NText As String, n As Long
NText = Left(UText, 1)
For n = 2 To Len(UText)
AsciVal = Asc(Mid(UText, n, 1))
If AsciVal >= 65 And AsciVal <= 90 Then
NText = NText & "," & Mid(UText, n, 1)
Else
NText = NText & Mid(UText, n, 1)
End If
Next n
InsComma = NText
End Function
Bookmarks