Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to expand a txt file

Status
Not open for further replies.

ahartoch

Vendor
May 28, 2003
12
ES
Hi,

I need some help with a text string. I would like some advice on how could I make with VB expand the following string. Let say I have the following string:

Packages 0-2,4,5,7-11,14,16-21,23-25,28,29,32-49,51-56,58-64,67,70-77,79-81,83,86-93,95,98-104,107-111,113,115,118-120,122-125,127-129,131-133,137-141,143-154,157,159-164,167,169,170,172,173,175,179-182,184,185,187,188,191-193,198,200,202-206,208-212,214-216,218,222,229,231,233-236,240,242,243,245-247,250,251,253,254,256,258,259,261,263,283,288,289,295,296,301,306,307,309,312,315,323,324,327,328,350,351,362,364,366,367,370,380-382,384,386,387,389
Extra Packages 22,174,252,284

I would like the macro to put the text into columns and expand the ranges. The first range is 0-2; I would like to have 3 rows 0
1
2
... and so on. The text string would sort out into rows. Do you get my point.
 
Take a look at the Mid function and at the Split function, first with "," as delimiter, then with "-".

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top