ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Convert Text String to Cells (https://www.excelbanter.com/excel-programming/272692-convert-text-string-cells.html)

John Ford

Convert Text String to Cells
 
A newbie question: What's a good way to format and process a text string to get it into a row of cells? Is there an excel method that parses strings into cells?

My excel macro gets a string from another application. The string is to be parsed into multiple cells within one row. I control the othe application, so I can build the string however I want. Should I use CSV? XML? Just put vbCrLf between data items?

Right now the string I'm parsing is CSV:

"item1","item2","etc.."

My macro has no idea how many items to expect - I just want it to put them in consecutive cells in the current row.

-jcf

Peter Bobrowski

Convert Text String to Cells
 
highlight the text and click the data menu and choose text to columns,
follow the prompts for your situation.

"John Ford" wrote in message
...
A newbie question: What's a good way to format and process a text string to
get it into a row of cells? Is there an excel method that parses strings
into cells?

My excel macro gets a string from another application. The string is to be
parsed into multiple cells within one row. I control the othe application,
so I can build the string however I want. Should I use CSV? XML? Just put
vbCrLf between data items?

Right now the string I'm parsing is CSV:

"item1","item2","etc.."

My macro has no idea how many items to expect - I just want it to put them
in consecutive cells in the current row.

-jcf



steve

Convert Text String to Cells
 
John,

Under the Data menu is an option for Text to Columns.
Manually copy and paste your text into a cell and play with this option.
After you get used to it - record a macro, than modify the recorded macro to
suit your needs.

steve

"John Ford" wrote in message
...
A newbie question: What's a good way to format and process a text string to
get it into a row of cells? Is there an excel method that parses strings
into cells?

My excel macro gets a string from another application. The string is to be
parsed into multiple cells within one row. I control the othe application,
so I can build the string however I want. Should I use CSV? XML? Just put
vbCrLf between data items?

Right now the string I'm parsing is CSV:

"item1","item2","etc.."

My macro has no idea how many items to expect - I just want it to put them
in consecutive cells in the current row.

-jcf



John Ford

Convert Text String to Cells
 
Hello? My macro is a VBA program that gets the string from another application - this isn't a user pointin' and clickin'. ;-)

HOWEVER... your reply lead me to do the old "record a macro and see how it works" techique. Sure enough, there's a myRange.TextToColumns method which it looks like it will do the trick.

Thanks,
-jcf

"Peter Bobrowski" wrote in message ...
| highlight the text and click the data menu and choose text to columns,
| follow the prompts for your situation.
|
| "John Ford" wrote in message
| ...
| A newbie question: What's a good way to format and process a text string to
| get it into a row of cells? Is there an excel method that parses strings
| into cells?
|
| My excel macro gets a string from another application. The string is to be
| parsed into multiple cells within one row. I control the othe application,
| so I can build the string however I want. Should I use CSV? XML? Just put
| vbCrLf between data items?
|
| Right now the string I'm parsing is CSV:
|
| "item1","item2","etc.."
|
| My macro has no idea how many items to expect - I just want it to put them
| in consecutive cells in the current row.
|
| -jcf
|
|


All times are GMT +1. The time now is 03:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com