tinderbox22
Board Regular
- Joined
- Mar 9, 2010
- Messages
- 56
- Office Version
- 365
- Platform
- Windows
Hello.
I'm attempting to write code that will copy and insert-down rows of data based on however many times a "," appears in a string.
I've already written a succesful 'Do Until' loop that copies and inserts down. I now need to go back to the newly inserted data and remove text before or after said ",".
Simplified Original data looks like this:
Column D:
D2: 300, 200, 100
D3: 400, 100
D5: 500
D6: 100, 300
My loop will copy that row and insert directly below each row the appropriate number of times based on the comma count. So, once that loop runs, updated data looks like this:
D2: 300, 200, 100
D3: 300, 200, 100
D4: 300, 200, 100
D5: 400, 100
D6: 400, 100
D7: 500
D8: 100, 300
D9: 100, 300
All's great so far. Now, here's where I'm stuck. What is the best way to get my new data to look like this:
D2: 300
D3: 200
D4: 100
D5: 400
D6: 100
D7: 500
D8: 100
D9: 300
I'm assuming I would need to find each instance of the comma within each row and then replace all text either before or after depending on where the comma sits, but that's where I get stuck.
Any and all help is greatly appreciated.
Thank you!
I'm attempting to write code that will copy and insert-down rows of data based on however many times a "," appears in a string.
I've already written a succesful 'Do Until' loop that copies and inserts down. I now need to go back to the newly inserted data and remove text before or after said ",".
Simplified Original data looks like this:
Column D:
D2: 300, 200, 100
D3: 400, 100
D5: 500
D6: 100, 300
My loop will copy that row and insert directly below each row the appropriate number of times based on the comma count. So, once that loop runs, updated data looks like this:
D2: 300, 200, 100
D3: 300, 200, 100
D4: 300, 200, 100
D5: 400, 100
D6: 400, 100
D7: 500
D8: 100, 300
D9: 100, 300
All's great so far. Now, here's where I'm stuck. What is the best way to get my new data to look like this:
D2: 300
D3: 200
D4: 100
D5: 400
D6: 100
D7: 500
D8: 100
D9: 300
I'm assuming I would need to find each instance of the comma within each row and then replace all text either before or after depending on where the comma sits, but that's where I get stuck.
Any and all help is greatly appreciated.
Thank you!