+ Reply to Thread
Results 1 to 34 of 34

Need Macro for List of Book Titles

  1. #1
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles


    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    Cells(i, "A").Value) - 4) & ", The"
    End If
    Next i

    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I

    need
    > to add ", The" (without quotes) to the end of each one of those book

    titles
    > and remove the "The" at the beginning of the title. I recorded a Macro

    for
    > it, but each time I use the Macro, it replaces the other cells with the

    title
    > of the one which I recorded. Thanks!




  2. #2
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Glad it worked out okay.

    Regards

    Bob


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:41C7D28D-FB6E-4536-9053-F3FB8DE16DED@microsoft.com...
    > Perfect! Thanks for your time. A few minutes of yours saved me many

    hours
    > of mine. You're the greatest!
    >
    > "Bob Phillips" wrote:
    >
    > > Wrap-around Edye. Try this
    > >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > Len(Cells(i, "A").Value) - 4) & ", The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > > > I get Comple Error: Sub or Function not defined. It highlights the

    last
    > > > "the" (w/o quotes).
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > > Sub BookTitles()
    > > > > Dim iLastRow As Long
    > > > > Dim i As Long
    > > > >
    > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > For i = 1 To iLastRow
    > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > > > Len(Cells(i, "A").Value) -

    4) &
    > > ",
    > > > > The"
    > > > > End If
    > > > > Next i
    > > > >
    > > > > End Sub
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > RP
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > >
    > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > > > One more little thing I noticed. There's a space b/w the end of t

    he
    > > title
    > > > > > and the ", The". How do I edit the macro to remove that space?
    > > > > >
    > > > > > "Bob Phillips" wrote:
    > > > > >
    > > > > > >
    > > > > > > Sub BookTitles()
    > > > > > > Dim iLastRow As Long
    > > > > > > Dim i As Long
    > > > > > >
    > > > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > > > For i = 1 To iLastRow
    > > > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value,

    Len( _
    > > > > > > Cells(i, "A").Value) -

    4) &
    > > ",
    > > > > The"
    > > > > > > End If
    > > > > > > Next i
    > > > > > >
    > > > > > > End Sub
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > >
    > > > > > > HTH
    > > > > > >
    > > > > > > RP
    > > > > > > (remove nothere from the email address if mailing direct)
    > > > > > >
    > > > > > >
    > > > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > > > Excel 2003
    > > > > > > > I have a list of books. About 700 contain a "The" at the

    > > beginning.
    > > > > I
    > > > > > > need
    > > > > > > > to add ", The" (without quotes) to the end of each one of

    those
    > > book
    > > > > > > titles
    > > > > > > > and remove the "The" at the beginning of the title. I

    recorded a
    > > > > Macro
    > > > > > > for
    > > > > > > > it, but each time I use the Macro, it replaces the other cells

    > > with
    > > > > the
    > > > > > > title
    > > > > > > > of the one which I recorded. Thanks!
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




  3. #3
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    Perfect! Thanks for your time. A few minutes of yours saved me many hours
    of mine. You're the greatest!

    "Bob Phillips" wrote:

    > Wrap-around Edye. Try this
    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > Len(Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > > I get Comple Error: Sub or Function not defined. It highlights the last
    > > "the" (w/o quotes).
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > Sub BookTitles()
    > > > Dim iLastRow As Long
    > > > Dim i As Long
    > > >
    > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > For i = 1 To iLastRow
    > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > > Len(Cells(i, "A").Value) - 4) &

    > ",
    > > > The"
    > > > End If
    > > > Next i
    > > >
    > > > End Sub
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > > One more little thing I noticed. There's a space b/w the end of the

    > title
    > > > > and the ", The". How do I edit the macro to remove that space?
    > > > >
    > > > > "Bob Phillips" wrote:
    > > > >
    > > > > >
    > > > > > Sub BookTitles()
    > > > > > Dim iLastRow As Long
    > > > > > Dim i As Long
    > > > > >
    > > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > > For i = 1 To iLastRow
    > > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > > > Cells(i, "A").Value) - 4) &

    > ",
    > > > The"
    > > > > > End If
    > > > > > Next i
    > > > > >
    > > > > > End Sub
    > > > > >
    > > > > >
    > > > > > --
    > > > > >
    > > > > > HTH
    > > > > >
    > > > > > RP
    > > > > > (remove nothere from the email address if mailing direct)
    > > > > >
    > > > > >
    > > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > > Excel 2003
    > > > > > > I have a list of books. About 700 contain a "The" at the

    > beginning.
    > > > I
    > > > > > need
    > > > > > > to add ", The" (without quotes) to the end of each one of those

    > book
    > > > > > titles
    > > > > > > and remove the "The" at the beginning of the title. I recorded a
    > > > Macro
    > > > > > for
    > > > > > > it, but each time I use the Macro, it replaces the other cells

    > with
    > > > the
    > > > > > title
    > > > > > > of the one which I recorded. Thanks!
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >


  4. #4
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Wrap-around Edye. Try this

    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    Len(Cells(i, "A").Value) - 4) & ", The"
    End If
    Next i

    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > I get Comple Error: Sub or Function not defined. It highlights the last
    > "the" (w/o quotes).
    >
    > "Bob Phillips" wrote:
    >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > Len(Cells(i, "A").Value) - 4) &

    ",
    > > The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > One more little thing I noticed. There's a space b/w the end of the

    title
    > > > and the ", The". How do I edit the macro to remove that space?
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > >
    > > > > Sub BookTitles()
    > > > > Dim iLastRow As Long
    > > > > Dim i As Long
    > > > >
    > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > For i = 1 To iLastRow
    > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > > Cells(i, "A").Value) - 4) &

    ",
    > > The"
    > > > > End If
    > > > > Next i
    > > > >
    > > > > End Sub
    > > > >
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > RP
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > >
    > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > Excel 2003
    > > > > > I have a list of books. About 700 contain a "The" at the

    beginning.
    > > I
    > > > > need
    > > > > > to add ", The" (without quotes) to the end of each one of those

    book
    > > > > titles
    > > > > > and remove the "The" at the beginning of the title. I recorded a

    > > Macro
    > > > > for
    > > > > > it, but each time I use the Macro, it replaces the other cells

    with
    > > the
    > > > > title
    > > > > > of the one which I recorded. Thanks!
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




  5. #5
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    I get Comple Error: Sub or Function not defined. It highlights the last
    "the" (w/o quotes).

    "Bob Phillips" wrote:

    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > Len(Cells(i, "A").Value) - 4) & ",
    > The"
    > End If
    > Next i
    >
    > End Sub
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > One more little thing I noticed. There's a space b/w the end of the title
    > > and the ", The". How do I edit the macro to remove that space?
    > >
    > > "Bob Phillips" wrote:
    > >
    > > >
    > > > Sub BookTitles()
    > > > Dim iLastRow As Long
    > > > Dim i As Long
    > > >
    > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > For i = 1 To iLastRow
    > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > Cells(i, "A").Value) - 4) & ",

    > The"
    > > > End If
    > > > Next i
    > > >
    > > > End Sub
    > > >
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > Excel 2003
    > > > > I have a list of books. About 700 contain a "The" at the beginning.

    > I
    > > > need
    > > > > to add ", The" (without quotes) to the end of each one of those book
    > > > titles
    > > > > and remove the "The" at the beginning of the title. I recorded a

    > Macro
    > > > for
    > > > > it, but each time I use the Macro, it replaces the other cells with

    > the
    > > > title
    > > > > of the one which I recorded. Thanks!
    > > >
    > > >
    > > >

    >
    >
    >


  6. #6
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    Len(Cells(i, "A").Value) - 4) & ",
    The"
    End If
    Next i

    End Sub

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > One more little thing I noticed. There's a space b/w the end of the title
    > and the ", The". How do I edit the macro to remove that space?
    >
    > "Bob Phillips" wrote:
    >
    > >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > Cells(i, "A").Value) - 4) & ",

    The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > Excel 2003
    > > > I have a list of books. About 700 contain a "The" at the beginning.

    I
    > > need
    > > > to add ", The" (without quotes) to the end of each one of those book

    > > titles
    > > > and remove the "The" at the beginning of the title. I recorded a

    Macro
    > > for
    > > > it, but each time I use the Macro, it replaces the other cells with

    the
    > > title
    > > > of the one which I recorded. Thanks!

    > >
    > >
    > >




  7. #7
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    One more little thing I noticed. There's a space b/w the end of the title
    and the ", The". How do I edit the macro to remove that space?

    "Bob Phillips" wrote:

    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I

    > need
    > > to add ", The" (without quotes) to the end of each one of those book

    > titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro

    > for
    > > it, but each time I use the Macro, it replaces the other cells with the

    > title
    > > of the one which I recorded. Thanks!

    >
    >
    >


  8. #8
    David Billigmeier
    Guest

    RE: Need Macro for List of Book Titles

    That will work, just assuming every book title has "The " at the beginning.
    If a book title doesn't, for example "Gone with the wind" it will output "
    with the wind, The"

    --
    David Billigmeier


    "Brian Synowiec" wrote:

    > How about this:
    > Assuming your book names start in A1, and the titles are less than 100
    > charecters (increase the 100 in the formula if they are longer);put this in
    > B1 and copy down:
    >
    > =MID(A1,4,100)&", The"
    >
    > Brian
    >
    >
    > "Edye" wrote:
    >
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I need
    > > to add ", The" (without quotes) to the end of each one of those book titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro for
    > > it, but each time I use the Macro, it replaces the other cells with the title
    > > of the one which I recorded. Thanks!


  9. #9
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    Worked perfectly. THANK YOU for saving me days of work!!!

    "Bob Phillips" wrote:

    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I

    > need
    > > to add ", The" (without quotes) to the end of each one of those book

    > titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro

    > for
    > > it, but each time I use the Macro, it replaces the other cells with the

    > title
    > > of the one which I recorded. Thanks!

    >
    >
    >


  10. #10
    Brian Synowiec
    Guest

    RE: Need Macro for List of Book Titles

    How about this:
    Assuming your book names start in A1, and the titles are less than 100
    charecters (increase the 100 in the formula if they are longer);put this in
    B1 and copy down:

    =MID(A1,4,100)&", The"

    Brian


    "Edye" wrote:

    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I need
    > to add ", The" (without quotes) to the end of each one of those book titles
    > and remove the "The" at the beginning of the title. I recorded a Macro for
    > it, but each time I use the Macro, it replaces the other cells with the title
    > of the one which I recorded. Thanks!


  11. #11
    David Billigmeier
    Guest

    RE: Need Macro for List of Book Titles

    You don't need vba, assuming all of the book title formats are the same, i.e.
    "The " is the first 4 characters of the title (including the space) you can
    use the following formula and just copy down to the end of your list:

    =IF(LEFT(A1,4)="the ",CONCATENATE(RIGHT(A1,LEN(A1)-4),", The"),A1)

    --
    David Billigmeier


    "Edye" wrote:

    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I need
    > to add ", The" (without quotes) to the end of each one of those book titles
    > and remove the "The" at the beginning of the title. I recorded a Macro for
    > it, but each time I use the Macro, it replaces the other cells with the title
    > of the one which I recorded. Thanks!


  12. #12
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles


    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    Cells(i, "A").Value) - 4) & ", The"
    End If
    Next i

    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I

    need
    > to add ", The" (without quotes) to the end of each one of those book

    titles
    > and remove the "The" at the beginning of the title. I recorded a Macro

    for
    > it, but each time I use the Macro, it replaces the other cells with the

    title
    > of the one which I recorded. Thanks!




  13. #13
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Wrap-around Edye. Try this

    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    Len(Cells(i, "A").Value) - 4) & ", The"
    End If
    Next i

    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > I get Comple Error: Sub or Function not defined. It highlights the last
    > "the" (w/o quotes).
    >
    > "Bob Phillips" wrote:
    >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > Len(Cells(i, "A").Value) - 4) &

    ",
    > > The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > One more little thing I noticed. There's a space b/w the end of the

    title
    > > > and the ", The". How do I edit the macro to remove that space?
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > >
    > > > > Sub BookTitles()
    > > > > Dim iLastRow As Long
    > > > > Dim i As Long
    > > > >
    > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > For i = 1 To iLastRow
    > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > > Cells(i, "A").Value) - 4) &

    ",
    > > The"
    > > > > End If
    > > > > Next i
    > > > >
    > > > > End Sub
    > > > >
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > RP
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > >
    > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > Excel 2003
    > > > > > I have a list of books. About 700 contain a "The" at the

    beginning.
    > > I
    > > > > need
    > > > > > to add ", The" (without quotes) to the end of each one of those

    book
    > > > > titles
    > > > > > and remove the "The" at the beginning of the title. I recorded a

    > > Macro
    > > > > for
    > > > > > it, but each time I use the Macro, it replaces the other cells

    with
    > > the
    > > > > title
    > > > > > of the one which I recorded. Thanks!
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




  14. #14
    David Billigmeier
    Guest

    RE: Need Macro for List of Book Titles

    You don't need vba, assuming all of the book title formats are the same, i.e.
    "The " is the first 4 characters of the title (including the space) you can
    use the following formula and just copy down to the end of your list:

    =IF(LEFT(A1,4)="the ",CONCATENATE(RIGHT(A1,LEN(A1)-4),", The"),A1)

    --
    David Billigmeier


    "Edye" wrote:

    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I need
    > to add ", The" (without quotes) to the end of each one of those book titles
    > and remove the "The" at the beginning of the title. I recorded a Macro for
    > it, but each time I use the Macro, it replaces the other cells with the title
    > of the one which I recorded. Thanks!


  15. #15
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    I get Comple Error: Sub or Function not defined. It highlights the last
    "the" (w/o quotes).

    "Bob Phillips" wrote:

    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > Len(Cells(i, "A").Value) - 4) & ",
    > The"
    > End If
    > Next i
    >
    > End Sub
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > One more little thing I noticed. There's a space b/w the end of the title
    > > and the ", The". How do I edit the macro to remove that space?
    > >
    > > "Bob Phillips" wrote:
    > >
    > > >
    > > > Sub BookTitles()
    > > > Dim iLastRow As Long
    > > > Dim i As Long
    > > >
    > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > For i = 1 To iLastRow
    > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > Cells(i, "A").Value) - 4) & ",

    > The"
    > > > End If
    > > > Next i
    > > >
    > > > End Sub
    > > >
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > Excel 2003
    > > > > I have a list of books. About 700 contain a "The" at the beginning.

    > I
    > > > need
    > > > > to add ", The" (without quotes) to the end of each one of those book
    > > > titles
    > > > > and remove the "The" at the beginning of the title. I recorded a

    > Macro
    > > > for
    > > > > it, but each time I use the Macro, it replaces the other cells with

    > the
    > > > title
    > > > > of the one which I recorded. Thanks!
    > > >
    > > >
    > > >

    >
    >
    >


  16. #16
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    Perfect! Thanks for your time. A few minutes of yours saved me many hours
    of mine. You're the greatest!

    "Bob Phillips" wrote:

    > Wrap-around Edye. Try this
    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > Len(Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > > I get Comple Error: Sub or Function not defined. It highlights the last
    > > "the" (w/o quotes).
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > Sub BookTitles()
    > > > Dim iLastRow As Long
    > > > Dim i As Long
    > > >
    > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > For i = 1 To iLastRow
    > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > > Len(Cells(i, "A").Value) - 4) &

    > ",
    > > > The"
    > > > End If
    > > > Next i
    > > >
    > > > End Sub
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > > One more little thing I noticed. There's a space b/w the end of the

    > title
    > > > > and the ", The". How do I edit the macro to remove that space?
    > > > >
    > > > > "Bob Phillips" wrote:
    > > > >
    > > > > >
    > > > > > Sub BookTitles()
    > > > > > Dim iLastRow As Long
    > > > > > Dim i As Long
    > > > > >
    > > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > > For i = 1 To iLastRow
    > > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > > > Cells(i, "A").Value) - 4) &

    > ",
    > > > The"
    > > > > > End If
    > > > > > Next i
    > > > > >
    > > > > > End Sub
    > > > > >
    > > > > >
    > > > > > --
    > > > > >
    > > > > > HTH
    > > > > >
    > > > > > RP
    > > > > > (remove nothere from the email address if mailing direct)
    > > > > >
    > > > > >
    > > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > > Excel 2003
    > > > > > > I have a list of books. About 700 contain a "The" at the

    > beginning.
    > > > I
    > > > > > need
    > > > > > > to add ", The" (without quotes) to the end of each one of those

    > book
    > > > > > titles
    > > > > > > and remove the "The" at the beginning of the title. I recorded a
    > > > Macro
    > > > > > for
    > > > > > > it, but each time I use the Macro, it replaces the other cells

    > with
    > > > the
    > > > > > title
    > > > > > > of the one which I recorded. Thanks!
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >


  17. #17
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    Len(Cells(i, "A").Value) - 4) & ",
    The"
    End If
    Next i

    End Sub

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > One more little thing I noticed. There's a space b/w the end of the title
    > and the ", The". How do I edit the macro to remove that space?
    >
    > "Bob Phillips" wrote:
    >
    > >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > Cells(i, "A").Value) - 4) & ",

    The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > Excel 2003
    > > > I have a list of books. About 700 contain a "The" at the beginning.

    I
    > > need
    > > > to add ", The" (without quotes) to the end of each one of those book

    > > titles
    > > > and remove the "The" at the beginning of the title. I recorded a

    Macro
    > > for
    > > > it, but each time I use the Macro, it replaces the other cells with

    the
    > > title
    > > > of the one which I recorded. Thanks!

    > >
    > >
    > >




  18. #18
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    One more little thing I noticed. There's a space b/w the end of the title
    and the ", The". How do I edit the macro to remove that space?

    "Bob Phillips" wrote:

    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I

    > need
    > > to add ", The" (without quotes) to the end of each one of those book

    > titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro

    > for
    > > it, but each time I use the Macro, it replaces the other cells with the

    > title
    > > of the one which I recorded. Thanks!

    >
    >
    >


  19. #19
    David Billigmeier
    Guest

    RE: Need Macro for List of Book Titles

    That will work, just assuming every book title has "The " at the beginning.
    If a book title doesn't, for example "Gone with the wind" it will output "
    with the wind, The"

    --
    David Billigmeier


    "Brian Synowiec" wrote:

    > How about this:
    > Assuming your book names start in A1, and the titles are less than 100
    > charecters (increase the 100 in the formula if they are longer);put this in
    > B1 and copy down:
    >
    > =MID(A1,4,100)&", The"
    >
    > Brian
    >
    >
    > "Edye" wrote:
    >
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I need
    > > to add ", The" (without quotes) to the end of each one of those book titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro for
    > > it, but each time I use the Macro, it replaces the other cells with the title
    > > of the one which I recorded. Thanks!


  20. #20
    Brian Synowiec
    Guest

    RE: Need Macro for List of Book Titles

    How about this:
    Assuming your book names start in A1, and the titles are less than 100
    charecters (increase the 100 in the formula if they are longer);put this in
    B1 and copy down:

    =MID(A1,4,100)&", The"

    Brian


    "Edye" wrote:

    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I need
    > to add ", The" (without quotes) to the end of each one of those book titles
    > and remove the "The" at the beginning of the title. I recorded a Macro for
    > it, but each time I use the Macro, it replaces the other cells with the title
    > of the one which I recorded. Thanks!


  21. #21
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Glad it worked out okay.

    Regards

    Bob


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:41C7D28D-FB6E-4536-9053-F3FB8DE16DED@microsoft.com...
    > Perfect! Thanks for your time. A few minutes of yours saved me many

    hours
    > of mine. You're the greatest!
    >
    > "Bob Phillips" wrote:
    >
    > > Wrap-around Edye. Try this
    > >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > Len(Cells(i, "A").Value) - 4) & ", The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > > > I get Comple Error: Sub or Function not defined. It highlights the

    last
    > > > "the" (w/o quotes).
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > > Sub BookTitles()
    > > > > Dim iLastRow As Long
    > > > > Dim i As Long
    > > > >
    > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > For i = 1 To iLastRow
    > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > > > Len(Cells(i, "A").Value) -

    4) &
    > > ",
    > > > > The"
    > > > > End If
    > > > > Next i
    > > > >
    > > > > End Sub
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > RP
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > >
    > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > > > One more little thing I noticed. There's a space b/w the end of t

    he
    > > title
    > > > > > and the ", The". How do I edit the macro to remove that space?
    > > > > >
    > > > > > "Bob Phillips" wrote:
    > > > > >
    > > > > > >
    > > > > > > Sub BookTitles()
    > > > > > > Dim iLastRow As Long
    > > > > > > Dim i As Long
    > > > > > >
    > > > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > > > For i = 1 To iLastRow
    > > > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value,

    Len( _
    > > > > > > Cells(i, "A").Value) -

    4) &
    > > ",
    > > > > The"
    > > > > > > End If
    > > > > > > Next i
    > > > > > >
    > > > > > > End Sub
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > >
    > > > > > > HTH
    > > > > > >
    > > > > > > RP
    > > > > > > (remove nothere from the email address if mailing direct)
    > > > > > >
    > > > > > >
    > > > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > > > Excel 2003
    > > > > > > > I have a list of books. About 700 contain a "The" at the

    > > beginning.
    > > > > I
    > > > > > > need
    > > > > > > > to add ", The" (without quotes) to the end of each one of

    those
    > > book
    > > > > > > titles
    > > > > > > > and remove the "The" at the beginning of the title. I

    recorded a
    > > > > Macro
    > > > > > > for
    > > > > > > > it, but each time I use the Macro, it replaces the other cells

    > > with
    > > > > the
    > > > > > > title
    > > > > > > > of the one which I recorded. Thanks!
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




  22. #22
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    Worked perfectly. THANK YOU for saving me days of work!!!

    "Bob Phillips" wrote:

    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I

    > need
    > > to add ", The" (without quotes) to the end of each one of those book

    > titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro

    > for
    > > it, but each time I use the Macro, it replaces the other cells with the

    > title
    > > of the one which I recorded. Thanks!

    >
    >
    >


  23. #23
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    Perfect! Thanks for your time. A few minutes of yours saved me many hours
    of mine. You're the greatest!

    "Bob Phillips" wrote:

    > Wrap-around Edye. Try this
    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > Len(Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > > I get Comple Error: Sub or Function not defined. It highlights the last
    > > "the" (w/o quotes).
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > Sub BookTitles()
    > > > Dim iLastRow As Long
    > > > Dim i As Long
    > > >
    > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > For i = 1 To iLastRow
    > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > > Len(Cells(i, "A").Value) - 4) &

    > ",
    > > > The"
    > > > End If
    > > > Next i
    > > >
    > > > End Sub
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > > One more little thing I noticed. There's a space b/w the end of the

    > title
    > > > > and the ", The". How do I edit the macro to remove that space?
    > > > >
    > > > > "Bob Phillips" wrote:
    > > > >
    > > > > >
    > > > > > Sub BookTitles()
    > > > > > Dim iLastRow As Long
    > > > > > Dim i As Long
    > > > > >
    > > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > > For i = 1 To iLastRow
    > > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > > > Cells(i, "A").Value) - 4) &

    > ",
    > > > The"
    > > > > > End If
    > > > > > Next i
    > > > > >
    > > > > > End Sub
    > > > > >
    > > > > >
    > > > > > --
    > > > > >
    > > > > > HTH
    > > > > >
    > > > > > RP
    > > > > > (remove nothere from the email address if mailing direct)
    > > > > >
    > > > > >
    > > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > > Excel 2003
    > > > > > > I have a list of books. About 700 contain a "The" at the

    > beginning.
    > > > I
    > > > > > need
    > > > > > > to add ", The" (without quotes) to the end of each one of those

    > book
    > > > > > titles
    > > > > > > and remove the "The" at the beginning of the title. I recorded a
    > > > Macro
    > > > > > for
    > > > > > > it, but each time I use the Macro, it replaces the other cells

    > with
    > > > the
    > > > > > title
    > > > > > > of the one which I recorded. Thanks!
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >


  24. #24
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles


    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    Cells(i, "A").Value) - 4) & ", The"
    End If
    Next i

    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I

    need
    > to add ", The" (without quotes) to the end of each one of those book

    titles
    > and remove the "The" at the beginning of the title. I recorded a Macro

    for
    > it, but each time I use the Macro, it replaces the other cells with the

    title
    > of the one which I recorded. Thanks!




  25. #25
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Wrap-around Edye. Try this

    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    Len(Cells(i, "A").Value) - 4) & ", The"
    End If
    Next i

    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > I get Comple Error: Sub or Function not defined. It highlights the last
    > "the" (w/o quotes).
    >
    > "Bob Phillips" wrote:
    >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > Len(Cells(i, "A").Value) - 4) &

    ",
    > > The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > One more little thing I noticed. There's a space b/w the end of the

    title
    > > > and the ", The". How do I edit the macro to remove that space?
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > >
    > > > > Sub BookTitles()
    > > > > Dim iLastRow As Long
    > > > > Dim i As Long
    > > > >
    > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > For i = 1 To iLastRow
    > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > > Cells(i, "A").Value) - 4) &

    ",
    > > The"
    > > > > End If
    > > > > Next i
    > > > >
    > > > > End Sub
    > > > >
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > RP
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > >
    > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > Excel 2003
    > > > > > I have a list of books. About 700 contain a "The" at the

    beginning.
    > > I
    > > > > need
    > > > > > to add ", The" (without quotes) to the end of each one of those

    book
    > > > > titles
    > > > > > and remove the "The" at the beginning of the title. I recorded a

    > > Macro
    > > > > for
    > > > > > it, but each time I use the Macro, it replaces the other cells

    with
    > > the
    > > > > title
    > > > > > of the one which I recorded. Thanks!
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




  26. #26
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Glad it worked out okay.

    Regards

    Bob


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:41C7D28D-FB6E-4536-9053-F3FB8DE16DED@microsoft.com...
    > Perfect! Thanks for your time. A few minutes of yours saved me many

    hours
    > of mine. You're the greatest!
    >
    > "Bob Phillips" wrote:
    >
    > > Wrap-around Edye. Try this
    > >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > Len(Cells(i, "A").Value) - 4) & ", The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:50D074FB-8499-4269-8574-CAEBA8C75299@microsoft.com...
    > > > I get Comple Error: Sub or Function not defined. It highlights the

    last
    > > > "the" (w/o quotes).
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > > Sub BookTitles()
    > > > > Dim iLastRow As Long
    > > > > Dim i As Long
    > > > >
    > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > For i = 1 To iLastRow
    > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > > > > Len(Cells(i, "A").Value) -

    4) &
    > > ",
    > > > > The"
    > > > > End If
    > > > > Next i
    > > > >
    > > > > End Sub
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > RP
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > >
    > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > > > > One more little thing I noticed. There's a space b/w the end of t

    he
    > > title
    > > > > > and the ", The". How do I edit the macro to remove that space?
    > > > > >
    > > > > > "Bob Phillips" wrote:
    > > > > >
    > > > > > >
    > > > > > > Sub BookTitles()
    > > > > > > Dim iLastRow As Long
    > > > > > > Dim i As Long
    > > > > > >
    > > > > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > > > > For i = 1 To iLastRow
    > > > > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > > > > Cells(i, "A").Value = Right(Cells(i, "A").Value,

    Len( _
    > > > > > > Cells(i, "A").Value) -

    4) &
    > > ",
    > > > > The"
    > > > > > > End If
    > > > > > > Next i
    > > > > > >
    > > > > > > End Sub
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > >
    > > > > > > HTH
    > > > > > >
    > > > > > > RP
    > > > > > > (remove nothere from the email address if mailing direct)
    > > > > > >
    > > > > > >
    > > > > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > > > > Excel 2003
    > > > > > > > I have a list of books. About 700 contain a "The" at the

    > > beginning.
    > > > > I
    > > > > > > need
    > > > > > > > to add ", The" (without quotes) to the end of each one of

    those
    > > book
    > > > > > > titles
    > > > > > > > and remove the "The" at the beginning of the title. I

    recorded a
    > > > > Macro
    > > > > > > for
    > > > > > > > it, but each time I use the Macro, it replaces the other cells

    > > with
    > > > > the
    > > > > > > title
    > > > > > > > of the one which I recorded. Thanks!
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >




  27. #27
    Edye
    Guest

    Need Macro for List of Book Titles

    Excel 2003
    I have a list of books. About 700 contain a "The" at the beginning. I need
    to add ", The" (without quotes) to the end of each one of those book titles
    and remove the "The" at the beginning of the title. I recorded a Macro for
    it, but each time I use the Macro, it replaces the other cells with the title
    of the one which I recorded. Thanks!

  28. #28
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    I get Comple Error: Sub or Function not defined. It highlights the last
    "the" (w/o quotes).

    "Bob Phillips" wrote:

    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    > Len(Cells(i, "A").Value) - 4) & ",
    > The"
    > End If
    > Next i
    >
    > End Sub
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > > One more little thing I noticed. There's a space b/w the end of the title
    > > and the ", The". How do I edit the macro to remove that space?
    > >
    > > "Bob Phillips" wrote:
    > >
    > > >
    > > > Sub BookTitles()
    > > > Dim iLastRow As Long
    > > > Dim i As Long
    > > >
    > > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > > For i = 1 To iLastRow
    > > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > > Cells(i, "A").Value) - 4) & ",

    > The"
    > > > End If
    > > > Next i
    > > >
    > > > End Sub
    > > >
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > > Excel 2003
    > > > > I have a list of books. About 700 contain a "The" at the beginning.

    > I
    > > > need
    > > > > to add ", The" (without quotes) to the end of each one of those book
    > > > titles
    > > > > and remove the "The" at the beginning of the title. I recorded a

    > Macro
    > > > for
    > > > > it, but each time I use the Macro, it replaces the other cells with

    > the
    > > > title
    > > > > of the one which I recorded. Thanks!
    > > >
    > > >
    > > >

    >
    >
    >


  29. #29
    Bob Phillips
    Guest

    Re: Need Macro for List of Book Titles

    Sub BookTitles()
    Dim iLastRow As Long
    Dim i As Long

    iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    For i = 1 To iLastRow
    If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    Cells(i, "A").Value = Right(Trim(Cells(i, "A").Value), _
    Len(Cells(i, "A").Value) - 4) & ",
    The"
    End If
    Next i

    End Sub

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Edye" <Edye@discussions.microsoft.com> wrote in message
    news:2D874923-5268-46CE-A145-CC3FF6C92473@microsoft.com...
    > One more little thing I noticed. There's a space b/w the end of the title
    > and the ", The". How do I edit the macro to remove that space?
    >
    > "Bob Phillips" wrote:
    >
    > >
    > > Sub BookTitles()
    > > Dim iLastRow As Long
    > > Dim i As Long
    > >
    > > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > > For i = 1 To iLastRow
    > > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > > Cells(i, "A").Value) - 4) & ",

    The"
    > > End If
    > > Next i
    > >
    > > End Sub
    > >
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > > Excel 2003
    > > > I have a list of books. About 700 contain a "The" at the beginning.

    I
    > > need
    > > > to add ", The" (without quotes) to the end of each one of those book

    > > titles
    > > > and remove the "The" at the beginning of the title. I recorded a

    Macro
    > > for
    > > > it, but each time I use the Macro, it replaces the other cells with

    the
    > > title
    > > > of the one which I recorded. Thanks!

    > >
    > >
    > >




  30. #30
    David Billigmeier
    Guest

    RE: Need Macro for List of Book Titles

    You don't need vba, assuming all of the book title formats are the same, i.e.
    "The " is the first 4 characters of the title (including the space) you can
    use the following formula and just copy down to the end of your list:

    =IF(LEFT(A1,4)="the ",CONCATENATE(RIGHT(A1,LEN(A1)-4),", The"),A1)

    --
    David Billigmeier


    "Edye" wrote:

    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I need
    > to add ", The" (without quotes) to the end of each one of those book titles
    > and remove the "The" at the beginning of the title. I recorded a Macro for
    > it, but each time I use the Macro, it replaces the other cells with the title
    > of the one which I recorded. Thanks!


  31. #31
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    One more little thing I noticed. There's a space b/w the end of the title
    and the ", The". How do I edit the macro to remove that space?

    "Bob Phillips" wrote:

    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I

    > need
    > > to add ", The" (without quotes) to the end of each one of those book

    > titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro

    > for
    > > it, but each time I use the Macro, it replaces the other cells with the

    > title
    > > of the one which I recorded. Thanks!

    >
    >
    >


  32. #32
    David Billigmeier
    Guest

    RE: Need Macro for List of Book Titles

    That will work, just assuming every book title has "The " at the beginning.
    If a book title doesn't, for example "Gone with the wind" it will output "
    with the wind, The"

    --
    David Billigmeier


    "Brian Synowiec" wrote:

    > How about this:
    > Assuming your book names start in A1, and the titles are less than 100
    > charecters (increase the 100 in the formula if they are longer);put this in
    > B1 and copy down:
    >
    > =MID(A1,4,100)&", The"
    >
    > Brian
    >
    >
    > "Edye" wrote:
    >
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I need
    > > to add ", The" (without quotes) to the end of each one of those book titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro for
    > > it, but each time I use the Macro, it replaces the other cells with the title
    > > of the one which I recorded. Thanks!


  33. #33
    Edye
    Guest

    Re: Need Macro for List of Book Titles

    Worked perfectly. THANK YOU for saving me days of work!!!

    "Bob Phillips" wrote:

    >
    > Sub BookTitles()
    > Dim iLastRow As Long
    > Dim i As Long
    >
    > iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
    > For i = 1 To iLastRow
    > If LCase(Left(Cells(i, "A").Value, 4)) = "the " Then
    > Cells(i, "A").Value = Right(Cells(i, "A").Value, Len( _
    > Cells(i, "A").Value) - 4) & ", The"
    > End If
    > Next i
    >
    > End Sub
    >
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Edye" <Edye@discussions.microsoft.com> wrote in message
    > news:85DF4268-CB44-495E-9830-AD7FC82BE4C1@microsoft.com...
    > > Excel 2003
    > > I have a list of books. About 700 contain a "The" at the beginning. I

    > need
    > > to add ", The" (without quotes) to the end of each one of those book

    > titles
    > > and remove the "The" at the beginning of the title. I recorded a Macro

    > for
    > > it, but each time I use the Macro, it replaces the other cells with the

    > title
    > > of the one which I recorded. Thanks!

    >
    >
    >


  34. #34
    Brian Synowiec
    Guest

    RE: Need Macro for List of Book Titles

    How about this:
    Assuming your book names start in A1, and the titles are less than 100
    charecters (increase the 100 in the formula if they are longer);put this in
    B1 and copy down:

    =MID(A1,4,100)&", The"

    Brian


    "Edye" wrote:

    > Excel 2003
    > I have a list of books. About 700 contain a "The" at the beginning. I need
    > to add ", The" (without quotes) to the end of each one of those book titles
    > and remove the "The" at the beginning of the title. I recorded a Macro for
    > it, but each time I use the Macro, it replaces the other cells with the title
    > of the one which I recorded. Thanks!


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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.6.0 RC 1