Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Splitting the contents.

I need to split the contets of column B and paste it in the rows
automatically. (As in the Answer below.

Question
Cloumn A Column B
EQ097-011210 EQ097-011202, EQ097-011203, EQ097-011204

Answer
EQ097-011210 EQ097-011202
EQ097-011203
EQ097-011204

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Splitting the contents.

You need a macro like the one below

Sub SplitCol()

LastRow = Range("B" & Rows.Count).End(xlUp).Row
RowCount = 1
Do While RowCount <= LastRow
If InStr(Range("B" & RowCount), ",") 0 Then
Rows(RowCount + 1).Insert

Rowdata = Range("B" & RowCount)
Range("B" & RowCount) = _
Trim(Left(Rowdata, InStr(Rowdata, ",") - 1))
Range("B" & (RowCount + 1)) = _
Trim(Mid(Rowdata, InStr(Rowdata, ",") + 1))
LastRow = LastRow + 1
End If
RowCount = RowCount + 1
Loop
End Sub


"Naveed" wrote:

I need to split the contets of column B and paste it in the rows
automatically. (As in the Answer below.

Question
Cloumn A Column B
EQ097-011210 EQ097-011202, EQ097-011203, EQ097-011204

Answer
EQ097-011210 EQ097-011202
EQ097-011203
EQ097-011204

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
splitting out cell contents ksh Excel Discussion (Misc queries) 2 January 14th 08 06:14 PM
Splitting cell contents GARY Excel Discussion (Misc queries) 3 November 5th 07 11:53 PM
Splitting cell contents GARY Excel Discussion (Misc queries) 1 November 5th 07 06:58 PM
Splitting the contents of a cell? Dan B Excel Worksheet Functions 4 December 8th 05 08:34 PM
Splitting up a cells contents Anthony Excel Worksheet Functions 3 September 1st 05 12:18 PM


All times are GMT +1. The time now is 03:47 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"