+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    01-07-2009
    Location
    worcester, ma
    MS-Off Ver
    Excel 2003
    Posts
    1

    How to print a column as a list of headings (for a karaoke book)

    Hey everyone,

    I'm wondering how to print a spreadsheet like this:

    Alice Adams, Song 1
    Alice Adams, Song 2
    Bob Baker, Song 1
    Bob Baker, Song 2
    Bob Baker, Song 3

    into something that looks like this:

    Alice Adams
    Song 1
    Song 2
    Bob Baker
    Song 1
    Song 2
    Song 3

    How do I do this in Excel?

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Cochrane,Alberta
    MS-Off Ver
    XL 2003,2007
    Posts
    6,257
    Maybe supply a sample workbook so somebody can work with it...
    Dave


  3. #3
    Valued Forum Contributor mdbct's Avatar
    Join Date
    11-11-2005
    Location
    CT
    MS-Off Ver
    2003 & 2007
    Posts
    843
    The following assumes the list is sorted and starts in column A and row 1. I've commented out the line that would delete the original column A after the seperation has taken place.

    Code:
    Sub moveIt()
        Dim i As Long, lRow As Long, strSing As String, strSong As String, strSingLast As String, iRow As Long
        lRow = Cells(Rows.Count, 1).End(xlUp).Row
        iRow = 1
        For i = 1 To lRow
            strSing = Trim(Left(Cells(i, 1), InStr(Cells(i, 1), ",") - 1))
            If strSing <> strSingLast Then
                Cells(iRow, 2) = strSing
                Cells(iRow, 2).Font.Bold = True
    
                iRow = iRow + 1
                strSingLast = strSing
            End If
            Cells(iRow, 2) = Trim(Mid(Cells(i, 1), InStr(Cells(i, 1), ",") + 1, 99))
            iRow = iRow + 1
        Next
    
        'Cells(1, 1).EntireColumn.Delete
    
    End Sub

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.2.0