How do I modifiy lines of data in a loop?

webmeister

New Member
Joined
Sep 13, 2006
Messages
38
In an Excel file I've got, the lines of data read as in this example:

R13,15,18-22,35

I need to have the data appear as follows:

R13,R15,R18,R19,R20,R21,R22,R35

I think I need some kind of loop or even a loop within a loop in order to preface each comma-delimited data item with a letter, and also to further break out the data item that reads 18-22, but I honestly have no idea of how to set that up in code, while also plowing through all lines of data.

Almost forgot.... there are also records that have no data at all.

If any one is willing to help a loop-challenged person, I would be very appreciative! Thanks in advance to those who reply....looking forward to it!
 
Hi, Norie....

Being fairly new to this wonderful forum, can you advise on how I can post my file for you? I downloaded the HTML program discussed in the FAQ section, but after that, am lost.

Thanks!!
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Hi, Norie,

I think I figured it out..... I changed your code snippet as follows:

Changed this line:
Range("N" & rng.Row).Offset(, X) = Left(arrItems(LBound(arrItems)), 1) & J

To this:
Range("N" & rng.Row) = Range("N" & rng.Row) & "," & Left(arrItems(LBound(arrItems)), 1) & J

and it is working.

Quick question for you... how would I post my data for you?? I downloaded and installed the HTML Maker utility from this forum, but then what do I do? If you wouldn't mind pointing me to where I can gt info about theutility, that would be great.

Norie, I can't thank you enough for your help!! I think it's great that you were willing to take the time and effort to assist me. Keep up the good work!!
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top