Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
Kishor
 
Posts: n/a
Default How is this?

'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

  #2   Report Post  
Posted to microsoft.public.excel.newusers
mudraker
 
Posts: n/a
Default How is this?


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?


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=540546

  #3   Report Post  
Posted to microsoft.public.excel.newusers
mudraker
 
Posts: n/a
Default How is this?


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?


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=540546

  #4   Report Post  
Posted to microsoft.public.excel.newusers
Kishor
 
Posts: n/a
Default How is this?

Thank u for point out the mistake.

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

THANKING U ONCE AGAIN.

"mudraker" wrote:


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?


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=540546


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"