+ Reply to Thread
Results 1 to 3 of 3

insert space in front of any question, if a space is not present

  1. #1
    Registered User
    Join Date
    12-09-2017
    Location
    Ohio
    MS-Off Ver
    Excel 2013 (home/student)
    Posts
    60

    insert space in front of any question, if a space is not present

    The code below pads every cell in the range with a trailing space. As part of the same macro, I need to insert a space in front of any question mark (the character, not the wild card) where a space is not already present. How would I add this to the code?
    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: insert space in front of any question, if a space is not present

    Try this.

    Also, it's not a good coding practice to name a variable the same as a VBA keyword; Dim Range As Range. I've seen it cause erratic behavior. I changed the variable to rng.

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    12-09-2017
    Location
    Ohio
    MS-Off Ver
    Excel 2013 (home/student)
    Posts
    60

    Re: insert space in front of any question, if a space is not present

    Thanks for the code, and the tip.

+ 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. [SOLVED] Insert space into string from back to front
    By sintek in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-17-2017, 04:58 AM
  2. [SOLVED] Removing a space that is in front of my date
    By RJL3313 in forum Excel General
    Replies: 2
    Last Post: 06-17-2015, 11:35 AM
  3. [SOLVED] Help Please! Cant understand what is this space in front of values
    By dimitrov_dimityr in forum Excel General
    Replies: 4
    Last Post: 10-21-2013, 06:55 AM
  4. [SOLVED] Insert a space in front of all upper case text
    By excelrod in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2012, 12:02 PM
  5. How to remove a space in the front
    By gurp99 in forum Excel General
    Replies: 12
    Last Post: 01-30-2011, 05:21 PM
  6. How to remove space and symbols in front of words
    By Jeff M in forum Excel General
    Replies: 2
    Last Post: 03-26-2009, 12:56 PM
  7. get rid of space in front of a word
    By CENorth7272 in forum Excel General
    Replies: 2
    Last Post: 02-01-2005, 10:19 AM

Tags for this Thread

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