View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
andrei[_4_] andrei[_4_] is offline
external usenet poster
 
Posts: 1
Default Macro that splits content from cell if given character is found


I give my example :

Column A : book titles
Column B : authors ( a book may have 1 or more authors which are
separated by a comma - like this : *John Doe , Michael Moore*

Column C , D ,E etc ... information regarding the titles which makes no
difference

The macro should read every cell in B column . If no comma is found
means it is only one author . Macro should copy the content from that
cell ( B1 ... Bn) to H column ( H1 ... Hn )

If 1 comma or more are found , means there are more authors . 1 comma
means there are 2 authors , 2 commas means there are 3 authors ... so on


Say there are 2 commas . The Macro should create 2 rows after the row
analysed with same content . More than that , should put in
corresponding H column the authors one by one . Example


A1: The fugitive B1 : John Doe , Michael Moore , Sasha Wild

The macro should to this :

A1: The fugitive B1 : John Doe , Michael Moore , Sasha Wild H1 :
John Doe
A2: The fugitive B2 : Jonh Doe , Michael Moore , Sasha Wild H2 :
Michael Moore
A3: The fugitive B3 : Jonh Doe , Michael Moore , Sasha Wild H3 :
Sasha Wild


The row number 2 ( A2 , B2 ... ) becomes row number 4 ( A4, B4 ...)
after macro does his job . Of course , it is also analysed by macro and
so on till macro find rows without text where it stops

Can this be done ?


--
andrei
------------------------------------------------------------------------
andrei's Profile: http://www.thecodecage.com/forumz/me...hp?userid=1056
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=147695