LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default extracting text from within a cell - 'text to rows@ equivalent of 'text to columns'

I believe this will do what you ask

Sub TextToColumns()
Sep = InputBox("Enter the separator type", "Separator")
If Sep = "" Then Exit Sub
For Each Cell In Selection
WholeLine = CStr(Cell.Value)
If Right(WholeLine, 1) < Sep Then
WholeLine = WholeLine & Sep
End If
RowNum = 0
Pos = 1
NextPos = InStr(Pos, WholeLine, Sep)
While NextPos = 1
TempVal = Mid(WholeLine, Pos, NextPos - Pos)
Cell.Offset(RowNum, 0).Value = TempVal
Pos = NextPos + 1
RowNum = RowNum + 1
NextPos = InStr(Pos, WholeLine, Sep)
Wend
Next
End Sub

Dan E

"peter smith" wrote in message
om...
I'm trying to work out how to extract text strings of varying length
from within a cell. The text instances I need to extract are all
between " ".
I then need to paste each piece of extracted text into cells a2, a3
,a4 etc.
I was planning to use 'text to columns' to spearate out the text but
am limited by the maximum number of columns (256).
Essentially what I need is something to provide the functionality of
'text to rows'.

e.g. In cell a1 I have the follwoing text:
"a","b","dog"

and what I need to do is enter "a" in cell a2, "b" in cell a3 and
"dog" in cell a4. Given that my actual data will covers more than 256
cells I can't just use text to columns, then transpose the data.

Any help greatly appreciated.
Peter



 
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting certain text from text string Haydie-lady[_2_] Excel Worksheet Functions 2 April 25th 09 09:55 AM
Extracting text from a cell kfowlow Excel Discussion (Misc queries) 2 November 17th 06 06:58 PM
Each rows last cell text value could be in any columns. Robert Christie Excel Worksheet Functions 6 May 2nd 06 06:53 PM
Extracting text from text string Emile Excel Worksheet Functions 3 March 30th 06 08:44 PM
Extracting Text in a string of text walkerdayle Excel Discussion (Misc queries) 5 December 19th 05 08:27 PM


All times are GMT +1. The time now is 06:28 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"