How is this?

K

Kishor

'Paste this macro in Worksheet_SelectionChange
'Type a sentence in Column "A" and select cell.

If ActiveCell.Column = 1 Then
rng = (ActiveCell.Text) & " "
l = Len(rng)
m = 1
k = 1
For i = 1 To l
If Mid(rng, i, 1) = " " Then
ActiveCell.Offset(0, m) = Mid(rng, k, i - k)
If Len(Mid(rng, k, i - k)) > 1 Then
m = m + 1
End If
k = i
End If
Next i
End If
 
M

mudraker

If 1st word is 2 or more charctors it seems to split sentance u
starting in column b

If 1st word is 1 charactor it places 2nd word in column B - is this th
way it is supposed to work
 
M

mudraker

If 1st word is 2 or more charctors it seems to split sentance up
starting in column b

If 1st word is 1 charactor it places 2nd word in column B - is this the
way it is supposed to work?
 
K

Kishor

Thank u for point out the mistake.

rng = " " & (ActiveCell.Text) & " "
is the correct code.

THANKING U ONCE AGAIN.
 

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

Top