CastingDirector
New Member
- Joined
- Jun 10, 2014
- Messages
- 46
Several months ago Rick Rothstein gave me the greatest help...I've now lost the code (too many incarnations). I pray someone can help.
Previous thread link Mr Excel: http://www.mrexcel.com/forum/excel-questions/852124-can-you-help-me-split-cell-use-first-part-new-row-heading.html
Here is a Before and after of what I am looking for. The Split in column E should create a heading with first part of split--listing the actors for that part (column c).
The second part of the split (string) should remain with the listed actor in the same row, column E.
As the code is now (above) it works the first time through but is messed up when other rows are copied onto the sheet or the sheet is viewed (activated when opened). I would like to add additional names via copy/past from other sheets to add to existing headings.
Arrgggg!
Any help is so gratefully acknowledged!
[TABLE="class: cms_table, width: 682"]
<tbody>[TR]
[TD]Status[/TD]
[TD][/TD]
[TD]Actor Name[/TD]
[TD]Agent[/TD]
[TD]Role/Notes[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]From this: (Sorted in another sheet macro):[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor C[/TD]
[TD]Rep Data[/TD]
[TD]Alice/TV pilot[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor H[/TD]
[TD]Rep Data[/TD]
[TD]Alice/Will tape[/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor G[/TD]
[TD]Rep Data[/TD]
[TD]Bob/Has TV show[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Bob/Will tape[/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 5:05 PM[/TD]
[TD]Actor F[/TD]
[TD]Rep Data[/TD]
[TD]Carol/Can't leave town[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor E[/TD]
[TD]Rep Data[/TD]
[TD]Carol/No to script[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:42 PM[/TD]
[TD]Actor D[/TD]
[TD]Rep Data[/TD]
[TD]Ted/Has another project[/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:40 PM[/TD]
[TD]Actor G[/TD]
[TD]Rep Data[/TD]
[TD]Bob/Has TV show[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:40 PM[/TD]
[TD]Actor E[/TD]
[TD]Rep Data[/TD]
[TD]Carol/No to script[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:41 PM[/TD]
[TD]Actor B[/TD]
[TD]Rep Data[/TD]
[TD]Ted/No to script[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:42 PM[/TD]
[TD]Actor I[/TD]
[TD]Rep Data[/TD]
[TD]Ted/No to script[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]To This:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Alice[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor C[/TD]
[TD]Rep Data[/TD]
[TD]TV pilot[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor H[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor G[/TD]
[TD]Rep Data[/TD]
[TD]Has TV show[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Carol[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:56 PM[/TD]
[TD]Actor F[/TD]
[TD]Rep Data[/TD]
[TD]Can't leave town[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Ted[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:58 PM[/TD]
[TD]Actor E[/TD]
[TD]Rep Data[/TD]
[TD]No to script[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor D[/TD]
[TD]Rep Data[/TD]
[TD]Has another project[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor B[/TD]
[TD]Rep Data[/TD]
[TD]No to script[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor I[/TD]
[TD]Rep Data[/TD]
[TD]No to script[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor C[/TD]
[TD]Rep Data[/TD]
[TD]TV pilot[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 2"]IF POSSIBLE ADD: (repeats those who indicate "will'' Tape")[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Will TAPE[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor H[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 5:00 PM
HERE IS THE CODE THAT ALMOST WORKS:[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Will tape
[/TD]
[/TR]
</tbody>[/TABLE]
Previous thread link Mr Excel: http://www.mrexcel.com/forum/excel-questions/852124-can-you-help-me-split-cell-use-first-part-new-row-heading.html
Here is a Before and after of what I am looking for. The Split in column E should create a heading with first part of split--listing the actors for that part (column c).
The second part of the split (string) should remain with the listed actor in the same row, column E.
As the code is now (above) it works the first time through but is messed up when other rows are copied onto the sheet or the sheet is viewed (activated when opened). I would like to add additional names via copy/past from other sheets to add to existing headings.
Arrgggg!
Any help is so gratefully acknowledged!
[TABLE="class: cms_table, width: 682"]
<tbody>[TR]
[TD]Status[/TD]
[TD][/TD]
[TD]Actor Name[/TD]
[TD]Agent[/TD]
[TD]Role/Notes[/TD]
[/TR]
[TR]
[TD]
[/TD]
[TD]From this: (Sorted in another sheet macro):[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor C[/TD]
[TD]Rep Data[/TD]
[TD]Alice/TV pilot[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor H[/TD]
[TD]Rep Data[/TD]
[TD]Alice/Will tape[/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor G[/TD]
[TD]Rep Data[/TD]
[TD]Bob/Has TV show[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Bob/Will tape[/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 5:05 PM[/TD]
[TD]Actor F[/TD]
[TD]Rep Data[/TD]
[TD]Carol/Can't leave town[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:26 PM[/TD]
[TD]Actor E[/TD]
[TD]Rep Data[/TD]
[TD]Carol/No to script[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:42 PM[/TD]
[TD]Actor D[/TD]
[TD]Rep Data[/TD]
[TD]Ted/Has another project[/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:40 PM[/TD]
[TD]Actor G[/TD]
[TD]Rep Data[/TD]
[TD]Bob/Has TV show[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:40 PM[/TD]
[TD]Actor E[/TD]
[TD]Rep Data[/TD]
[TD]Carol/No to script[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:41 PM[/TD]
[TD]Actor B[/TD]
[TD]Rep Data[/TD]
[TD]Ted/No to script[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:42 PM[/TD]
[TD]Actor I[/TD]
[TD]Rep Data[/TD]
[TD]Ted/No to script[/TD]
[/TR]
[TR]
[TD][/TD]
[TD]To This:[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Alice[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor C[/TD]
[TD]Rep Data[/TD]
[TD]TV pilot[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor H[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Bob[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor G[/TD]
[TD]Rep Data[/TD]
[TD]Has TV show[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:57 PM[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Carol[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAA[/TD]
[TD]07/21/15 4:56 PM[/TD]
[TD]Actor F[/TD]
[TD]Rep Data[/TD]
[TD]Can't leave town[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Ted[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:58 PM[/TD]
[TD]Actor E[/TD]
[TD]Rep Data[/TD]
[TD]No to script[/TD]
[/TR]
[TR]
[TD]NA[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor D[/TD]
[TD]Rep Data[/TD]
[TD]Has another project[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor B[/TD]
[TD]Rep Data[/TD]
[TD]No to script[/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor I[/TD]
[TD]Rep Data[/TD]
[TD]No to script[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor C[/TD]
[TD]Rep Data[/TD]
[TD]TV pilot[/TD]
[/TR]
[TR]
[TD][/TD]
[TD="colspan: 2"]IF POSSIBLE ADD: (repeats those who indicate "will'' Tape")[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD]Will TAPE[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NAA-Tape[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor H[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 4:54 PM[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Will tape[/TD]
[/TR]
[TR]
[TD]PASS[/TD]
[TD]07/21/15 5:00 PM
HERE IS THE CODE THAT ALMOST WORKS:[/TD]
[TD]Actor A[/TD]
[TD]Rep Data[/TD]
[TD]Will tape
Code:
[COLOR=blue]Sub[/COLOR] reorg()
[COLOR=blue]Dim[/COLOR] sh [COLOR=blue]As[/COLOR] Worksheet, lr [COLOR=blue]As[/COLOR] [COLOR=blue]Long[/COLOR], spl [COLOR=blue]As[/COLOR] [COLOR=blue]Variant[/COLOR], fn [COLOR=blue]As[/COLOR] Range, i [COLOR=blue]As[/COLOR] [COLOR=blue]Long[/COLOR]
[COLOR=blue]Set[/COLOR] sh = Sheet4
[COLOR=blue]With[/COLOR] Rows("7:99")
lr = sh.Cells(Rows.Count, "E").End(xlUp).Row
[COLOR=blue]For[/COLOR] i = lr [COLOR=blue]To[/COLOR] 2 [COLOR=blue]Step[/COLOR] -1
spl = Split(sh.Cells(i, 5).Value, "/")
[COLOR=blue]If[/COLOR] Application.CountIf(sh.Range("C:C"), Trim(spl([COLOR=blue]LBound[/COLOR](spl)))) > 0 [COLOR=blue]Then[/COLOR] [COLOR=#006400]'// Color Tag Removed[/COLOR]
[COLOR=blue]Set[/COLOR] fn = sh.Range("C:C").Find(Trim(spl([COLOR=blue]LBound[/COLOR](spl))), , xlValues, xlWhole)
[COLOR=blue]With[/COLOR] fn
.Font.Bold = [COLOR=blue]True[/COLOR]
.Font.Size = 14
[COLOR=blue]End With[/COLOR]
[COLOR=blue]If[/COLOR] [COLOR=blue]Not[/COLOR] fn [COLOR=blue]Is[/COLOR] [COLOR=blue]Nothing[/COLOR] [COLOR=blue]Then[/COLOR]
Rows(i).Copy
fn.Offset(1, 0).EntireRow.Insert
fn.Offset(1, 3) = Trim(spl([COLOR=blue]UBound[/COLOR](spl)))
Rows(i).Delete
[COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
[COLOR=blue]Else[/COLOR]
sh.Rows(i).Insert
sh.Range("C" & i) = Trim(spl([COLOR=blue]LBound[/COLOR](spl)))
sh.Range("E" & i + 1) = Trim(spl([COLOR=blue]UBound[/COLOR](spl)))
[COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR]
[COLOR=blue]Next[/COLOR] i
[COLOR=blue]End With[/COLOR]
[COLOR=blue]End Sub[/COLOR]
[/TD]
[/TR]
</tbody>[/TABLE]