Split and create sorted headings from first part of string

CastingDirector

New Member
Joined
Jun 10, 2014
Messages
46
Hi and thank you. Here is the dilemma...I need to
Split the last column and create a heading from the first part of the split with the "/" as seperator.
Then sort the heading alphabetically.
I Have this:

DATE NAMEAGENTROLE/NOTE
1/21/2015Actor AwmGeorge/Likes script
1/22/2015Actor DACABob/Cannot travel
2/22/2015Actor BcaaJimmy/Wife Pregnant
3/1/2015Actor EWolfGeorge/ Won't fly
12/2/2014Actor CSlickJimmy/Working
12/21/2014Actor FwmBob/will work for food

<tbody>
</tbody>

I need this:
(Notice an added row to visually separate the "role" headings and if possible, make them bold.
Finally, new "Actors"will be added to the sheet multiple times via another pages' paste.)


DATE NAMEAGENTROLE/NOTE
BOB
1/22/2015Actor BCAAWife Pregnant
1/21/2015Actor FwmWill work for food
GEORGE
1/21/2015Actor AwmLikes script
3/1/2015Actor EWolfWon't Fly
JIMMY
2/22/2015Actor BcaaWife Pregnant
12/2/2014Actor CSlickWorking

<tbody>
</tbody>

I know this is alot and your help means the world to me
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
with your table starting in A1, does this do what you want?


Code:
Sub mrExcel10022015()
Dim x As Long


Application.ScreenUpdating = False


With Range("D2:D" & Range("D" & Rows.Count).End(xlUp).Row)
    .TextToColumns , xlDelimited, xlTextQualifierNone, False, False, False, False, False, True, "/"
    .CurrentRegion.Sort .Worksheet.Range("D1"), xlAscending, , , , , , xlYes
End With


For x = Range("D" & Rows.Count).End(xlUp).Row To 2 Step -1
    If StrComp(Range("D" & x).Value, Range("D" & x - 1).Value, vbTextCompare) <> 0 Then
        Range("D" & x).EntireRow.Insert
        With Range("A" & x)
            .Value = Range("D" & x + 1).Value
            .Font.Bold = True
        End With
    End If
Next x
Range("e2:e" & Range("e" & Rows.Count).End(xlUp).Row).Cut Range("D2")
End Sub
 
Upvote 0
Thanks so much. This runs but needs tweaking (on my part I'm sure). The sheet contains a date column (not mentioned in my post for clarity :\) The range is actually "E10:E99". It is a pretty easy fix for me and for that I am so grateful for your help!
 
Upvote 0
Thank you. I am an idiot as I did not mention that there is another column (not posted for example clarity ;\). The range is actually "E10:E99" and is an easy fix I'm sure. Thanks you so much.
SOLVED
 
Upvote 0
no problem let me know if you encounter difficulties
Hi,
I,m afraid I couldn't get this tweeked. The split cell does move into a bold heading into the new row as coded. The second part of the split, however, disappears completely and I need it to remain in the same position on the row. Also, when new data is added after the operation is performed, I am hoping that the row is inserted to the existing, established arrangement. Finally, the empty range begins in row 7 and is now starting above that. I guess I needed more assistance than I thought. I really appreciate your help.
 
Upvote 0

Forum statistics

Threads
1,215,219
Messages
6,123,689
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top