+ Reply to Thread
Results 1 to 3 of 3

If text string BEGINS with 5 spaces then shift cell to the right

  1. #1
    Forum Contributor
    Join Date
    07-29-2013
    Location
    Oshawa
    MS-Off Ver
    Excel 2010
    Posts
    660

    If text string BEGINS with 5 spaces then shift cell to the right

    Hi everyone,

    Have real trouble with this one. Column B has a few thousand cells which contains numbers, letters and other characters. Some of these strings begin with 5 spaces, others begin with 10 spaces.

    ie. ' SomethingSomethingSomething
    ie.' Darkside

    What I'm trying to do is write a macro which will go through column B, find any cells with strings that BEGIN with 5 spaces and move them over to the right 1 column. If the string BEGINS with 10 spaces, then move it over to the right 2 columns.

    Any ideas?

    Thanks!!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,628

    Re: If text string BEGINS with 5 spaces then shift cell to the right

    Try:

    Please Login or Register  to view this content.
    Last edited by TMS; 03-14-2017 at 09:41 AM. Reason: Fix type A => B
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,628

    Re: If text string BEGINS with 5 spaces then shift cell to the right

    A bit neater:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 06-30-2015, 10:28 AM
  2. [SOLVED] Add spaces between numbers and text in string
    By c3po in forum Excel General
    Replies: 5
    Last Post: 09-16-2012, 07:30 PM
  3. Check if a string begins with substring and then change text
    By booo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2010, 03:39 PM
  4. Add 3 spaces before last word in string of text
    By HMM in forum Excel General
    Replies: 7
    Last Post: 11-09-2010, 10:24 AM
  5. insert spaces into text string
    By mmwltd in forum Excel General
    Replies: 6
    Last Post: 04-27-2010, 01:05 PM
  6. Adding spaces between certain text string
    By g_hadgraft in forum Excel General
    Replies: 1
    Last Post: 06-16-2009, 07:50 AM
  7. Text string with unwanted spaces
    By bigskyhy in forum Excel General
    Replies: 2
    Last Post: 11-13-2008, 08:57 PM

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