+ Reply to Thread
Results 1 to 6 of 6

Excel 2007 : Add something to the beginning and end of the string

  1. #1
    Registered User
    Join Date
    03-24-2010
    Location
    USA
    MS-Off Ver
    MS Office Professional 2010
    Posts
    33

    Add something to the beginning and end of the string

    I've got a list of words in column B that I'm trying make a very simple change. But the macro that I recorded is not achieving the desired effect.

    In col. B I've got the following:
    Summer Days
    Ice Cream
    Fall colors
    Breezy Winds

    Actually the list goes on & on.... much longer but that's a good sample.
    I need it change to:

    "Summer Days" move
    "Ice Cream" move
    "Fall colors" move
    "Breezy Winds" move

    So I recorded a macro thinking this will be a very simple problem to solve. But the macro that i recorded gave me this:

    Please Login or Register  to view this content.
    Any ideas?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Add something to the beginning and end of the string

    Something like this:
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 09-07-2010 at 04:59 PM.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Add something to the beginning and end of the string

    Why bother with a macro when a simple

    Please Login or Register  to view this content.
    formula will do.

    If you really want VBA code then use

    Please Login or Register  to view this content.
    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Registered User
    Join Date
    03-24-2010
    Location
    USA
    MS-Off Ver
    MS Office Professional 2010
    Posts
    33

    Re: Add something to the beginning and end of the string

    Ok a few problems. Firstly, JBeaucaire when I run your code, it puts the word move inside the quotation marks. I need the words wrapped in quotes "Ice Cream" followed by a space, then the word move with no quotes. Please see my original post above. And the data I'm trying to manipulate will always be column B so I'd like for it to be automatic without having to select cells or columns.

    And secondly, Richard, the answer to your question (about why I want a VBA code) is that I have bunch of stuff in columns A thru R and it fills up the entire width of my screen. I really don't want to have an extra column (col. S) just to make the change. I just want to run the code to make the changes in col B only. (Also not sure why you've got something to do with Cell A1 in your code.... that's rather odd....

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,971

    Re: Add something to the beginning and end of the string

    Just a small tweak to JB's code:
    Please Login or Register  to view this content.
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Registered User
    Join Date
    03-24-2010
    Location
    USA
    MS-Off Ver
    MS Office Professional 2010
    Posts
    33

    Re: Add something to the beginning and end of the string

    Thanks romperstomper.

+ 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