Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default New row after every comma

Hello,

can anybody help me out with this problem. I have a sheet with about 15
columns and 100 rows. I would like to insert an extra row after the comma in
column D. My sheet looks like this:
A B C D

test1 red 50 3,5,23,67,56,23,4
test2 blue 60 5,6,87,54,98
test3 orange 40 7,87,52,16

My output will look like this:

A B C D

test1 red 50 3
5
23
67
56
23
4
test2 blue 60 5
6
87
54
98
test3 orange 40 7
87
52
16

Can anybody help me out??? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default New row after every comma

See your first post.

TooN wrote:

Hello,

can anybody help me out with this problem. I have a sheet with about 15
columns and 100 rows. I would like to insert an extra row after the comma in
column D. My sheet looks like this:
A B C D

test1 red 50 3,5,23,67,56,23,4
test2 blue 60 5,6,87,54,98
test3 orange 40 7,87,52,16

My output will look like this:

A B C D

test1 red 50 3
5
23
67
56
23
4
test2 blue 60 5
6
87
54
98
test3 orange 40 7
87
52
16

Can anybody help me out??? Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 269
Default New row after every comma

Too, How about this? Backup your file first just in case. Then reopen
the original file, copy this code, put it in a standard module and run
it. James

Sub SplitColD()
Dim k As Integer, m As Long, tempStr As String
For m = Cells(65536, "a").End(xlUp).Row To 1 Step -1
If Cells(m, "d") < "" Then
For k = Len(Cells(m, "d")) To 1 Step -1
If Mid(Cells(m, "d"), k, 1) = "," Then
Rows(m + 1).EntireRow.Insert
Cells(m + 1, "d") = tempStr
tempStr = ""
Else
tempStr = Mid(Cells(m, "d"), k, 1) & tempStr
End If
Next k
tempStr = ""
For k = 1 To Len(Cells(m, "d"))
If Mid(Cells(m, "d"), k, 1) = "," Then
Cells(m, "d") = tempStr
tempStr = ""
Exit For
Else
tempStr = tempStr & Mid(Cells(m, "d"), k, 1)
End If
Next k
End If
Next m
End Sub
TooN wrote:
Hello,

can anybody help me out with this problem. I have a sheet with about 15
columns and 100 rows. I would like to insert an extra row after the comma in
column D. My sheet looks like this:
A B C D

test1 red 50 3,5,23,67,56,23,4
test2 blue 60 5,6,87,54,98
test3 orange 40 7,87,52,16

My output will look like this:

A B C D

test1 red 50 3
5
23
67
56
23
4
test2 blue 60 5
6
87
54
98
test3 orange 40 7
87
52
16

Can anybody help me out??? Thanks


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default New row after every comma

Hello Zone,

I installed the macro and got it running. There is only one smaal problem.
Sometimes the macro copies a value from the cell under the specified row and
copies that into the cell above. Example of my output:

test1 red 50 3
5
23
67
56
23
45
test2 blue 60 5
6
87
54
987
test3 orange 40 7
87
52
16

As you can see in test 1, the last number has to be 4 but it copies the next
cell as well. In test 2 it says 987, this has got to be 98. The seven is
copied wrong??

Thanks in advance for helping me out. If you need more detail about the
problem let me know!

TooN


"Zone" wrote:

Too, How about this? Backup your file first just in case. Then reopen
the original file, copy this code, put it in a standard module and run
it. James

Sub SplitColD()
Dim k As Integer, m As Long, tempStr As String
For m = Cells(65536, "a").End(xlUp).Row To 1 Step -1
If Cells(m, "d") < "" Then
For k = Len(Cells(m, "d")) To 1 Step -1
If Mid(Cells(m, "d"), k, 1) = "," Then
Rows(m + 1).EntireRow.Insert
Cells(m + 1, "d") = tempStr
tempStr = ""
Else
tempStr = Mid(Cells(m, "d"), k, 1) & tempStr
End If
Next k
tempStr = ""
For k = 1 To Len(Cells(m, "d"))
If Mid(Cells(m, "d"), k, 1) = "," Then
Cells(m, "d") = tempStr
tempStr = ""
Exit For
Else
tempStr = tempStr & Mid(Cells(m, "d"), k, 1)
End If
Next k
End If
Next m
End Sub
TooN wrote:
Hello,

can anybody help me out with this problem. I have a sheet with about 15
columns and 100 rows. I would like to insert an extra row after the comma in
column D. My sheet looks like this:
A B C D

test1 red 50 3,5,23,67,56,23,4
test2 blue 60 5,6,87,54,98
test3 orange 40 7,87,52,16

My output will look like this:

A B C D

test1 red 50 3
5
23
67
56
23
4
test2 blue 60 5
6
87
54
98
test3 orange 40 7
87
52
16

Can anybody help me out??? Thanks



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 269
Default New row after every comma

TooN, I could not recreate the problem. But I did clean up the code.
Try this in place of the original code. Let me know if it fixes the
problem! James

Sub SplitColD()
Dim k As Integer, m As Long, tempStr As String
tempStr=""
For m = Cells(65536, "a").End(xlUp).Row To 1 Step -1
If Cells(m, "d") < "" Then
For k = Len(Cells(m, "d")) To 1 Step -1
If Mid(Cells(m, "d"), k, 1) = "," Then
Rows(m + 1).EntireRow.Insert
Cells(m + 1, "d") = tempStr
tempStr = ""
Else
tempStr = Mid(Cells(m, "d"), k, 1) & tempStr
End If
Next k
Cells(m, "d") = tempStr
tempStr = ""
End If
Next m
End Sub

TooN wrote:
Hello Zone,

I installed the macro and got it running. There is only one smaal problem.
Sometimes the macro copies a value from the cell under the specified row and
copies that into the cell above. Example of my output:

test1 red 50 3
5
23
67
56
23
45
test2 blue 60 5
6
87
54
987
test3 orange 40 7
87
52
16

As you can see in test 1, the last number has to be 4 but it copies the next
cell as well. In test 2 it says 987, this has got to be 98. The seven is
copied wrong??

Thanks in advance for helping me out. If you need more detail about the
problem let me know!

TooN


"Zone" wrote:

Too, How about this? Backup your file first just in case. Then reopen
the original file, copy this code, put it in a standard module and run
it. James

Sub SplitColD()
Dim k As Integer, m As Long, tempStr As String
For m = Cells(65536, "a").End(xlUp).Row To 1 Step -1
If Cells(m, "d") < "" Then
For k = Len(Cells(m, "d")) To 1 Step -1
If Mid(Cells(m, "d"), k, 1) = "," Then
Rows(m + 1).EntireRow.Insert
Cells(m + 1, "d") = tempStr
tempStr = ""
Else
tempStr = Mid(Cells(m, "d"), k, 1) & tempStr
End If
Next k
tempStr = ""
For k = 1 To Len(Cells(m, "d"))
If Mid(Cells(m, "d"), k, 1) = "," Then
Cells(m, "d") = tempStr
tempStr = ""
Exit For
Else
tempStr = tempStr & Mid(Cells(m, "d"), k, 1)
End If
Next k
End If
Next m
End Sub
TooN wrote:
Hello,

can anybody help me out with this problem. I have a sheet with about 15
columns and 100 rows. I would like to insert an extra row after the comma in
column D. My sheet looks like this:
A B C D

test1 red 50 3,5,23,67,56,23,4
test2 blue 60 5,6,87,54,98
test3 orange 40 7,87,52,16

My output will look like this:

A B C D

test1 red 50 3
5
23
67
56
23
4
test2 blue 60 5
6
87
54
98
test3 orange 40 7
87
52
16

Can anybody help me out??? Thanks






  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35
Default New row after every comma

It works.... thanks, you saved me a lot of time :-)

"Zone" wrote:

TooN, I could not recreate the problem. But I did clean up the code.
Try this in place of the original code. Let me know if it fixes the
problem! James

Sub SplitColD()
Dim k As Integer, m As Long, tempStr As String
tempStr=""
For m = Cells(65536, "a").End(xlUp).Row To 1 Step -1
If Cells(m, "d") < "" Then
For k = Len(Cells(m, "d")) To 1 Step -1
If Mid(Cells(m, "d"), k, 1) = "," Then
Rows(m + 1).EntireRow.Insert
Cells(m + 1, "d") = tempStr
tempStr = ""
Else
tempStr = Mid(Cells(m, "d"), k, 1) & tempStr
End If
Next k
Cells(m, "d") = tempStr
tempStr = ""
End If
Next m
End Sub

TooN wrote:
Hello Zone,

I installed the macro and got it running. There is only one smaal problem.
Sometimes the macro copies a value from the cell under the specified row and
copies that into the cell above. Example of my output:

test1 red 50 3
5
23
67
56
23
45
test2 blue 60 5
6
87
54
987
test3 orange 40 7
87
52
16

As you can see in test 1, the last number has to be 4 but it copies the next
cell as well. In test 2 it says 987, this has got to be 98. The seven is
copied wrong??

Thanks in advance for helping me out. If you need more detail about the
problem let me know!

TooN


"Zone" wrote:

Too, How about this? Backup your file first just in case. Then reopen
the original file, copy this code, put it in a standard module and run
it. James

Sub SplitColD()
Dim k As Integer, m As Long, tempStr As String
For m = Cells(65536, "a").End(xlUp).Row To 1 Step -1
If Cells(m, "d") < "" Then
For k = Len(Cells(m, "d")) To 1 Step -1
If Mid(Cells(m, "d"), k, 1) = "," Then
Rows(m + 1).EntireRow.Insert
Cells(m + 1, "d") = tempStr
tempStr = ""
Else
tempStr = Mid(Cells(m, "d"), k, 1) & tempStr
End If
Next k
tempStr = ""
For k = 1 To Len(Cells(m, "d"))
If Mid(Cells(m, "d"), k, 1) = "," Then
Cells(m, "d") = tempStr
tempStr = ""
Exit For
Else
tempStr = tempStr & Mid(Cells(m, "d"), k, 1)
End If
Next k
End If
Next m
End Sub
TooN wrote:
Hello,

can anybody help me out with this problem. I have a sheet with about 15
columns and 100 rows. I would like to insert an extra row after the comma in
column D. My sheet looks like this:
A B C D

test1 red 50 3,5,23,67,56,23,4
test2 blue 60 5,6,87,54,98
test3 orange 40 7,87,52,16

My output will look like this:

A B C D

test1 red 50 3
5
23
67
56
23
4
test2 blue 60 5
6
87
54
98
test3 orange 40 7
87
52
16

Can anybody help me out??? Thanks




Reply
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
Using Comma in customise option samahoque Excel Worksheet Functions 1 August 8th 06 12:51 PM
Comma Deliminated File Format Olan Gotcher Excel Discussion (Misc queries) 5 July 16th 06 01:10 AM
Extra comma at the end of a function SYerby Excel Discussion (Misc queries) 3 July 14th 06 04:53 PM
Applying Indian comma style NAVEEN Excel Discussion (Misc queries) 1 February 22nd 06 08:59 AM
HELP - I need to change space delimited to comma? Mayer Excel Discussion (Misc queries) 1 December 18th 04 06:21 PM


All times are GMT +1. The time now is 08:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"