+ Reply to Thread
Results 1 to 5 of 5

Inserting Space In Cells

  1. #1
    Registered User
    Join Date
    09-10-2014
    Location
    OKC, OK
    MS-Off Ver
    2010
    Posts
    18

    Question Inserting Space In Cells

    My question is about inserting spaces in a cell in Excel 2010.

    The cells have times in them and they are in standard time with no space between the period. An example would be 2:00PM

    I would like to know how I could add a space between the time and the period. I have already formatted the cells to transform standard time to military time, but the space is required to make that happen. I would not have a problem clicking on each cell and pressing the space bar, but there are over 16,000 cells.

    I have done some research and I see that one method is using a code in VBA to automatically add the spaces in all of the cells, but I am unfamiliar with Excel programming.

    The range of cells begins at B12, C12 and ends at B8326, C8326.

    Thanks!

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Inserting Space In Cells

    custom format it with your spaces, or in vba use Format

    format(now, "hh mm ss") gives 16 27 01
    format(now, "hh-mm-ss") gives 16-27-01
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Expert
    Join Date
    06-25-2009
    Location
    Sofia, Bulgaria, EU
    MS-Off Ver
    Excel 2003-2013
    Posts
    1,290

    Re: Inserting Space In Cells

    what do you have in the cells? is it proper excel time value (i.e. decimal number between 0 and 1) or text string?
    If it is the former period is just a representation and even if you add space, it will reset to the same number format again. In this case just use custom number format to add space between number and the period.
    If it is string then you can use standard find/replace functionality in excel. i.e. replace "PM" with " PM"
    If you are pleased with a member's answer then use the Star icon to rate it.

  4. #4
    Registered User
    Join Date
    09-10-2014
    Location
    OKC, OK
    MS-Off Ver
    2010
    Posts
    18

    Re: Inserting Space In Cells

    That was a perfect fix! Thanks!!

    Quote Originally Posted by nathansav View Post
    custom format it with your spaces, or in vba use Format

    format(now, "hh mm ss") gives 16 27 01
    format(now, "hh-mm-ss") gives 16-27-01

  5. #5
    Registered User
    Join Date
    09-10-2014
    Location
    OKC, OK
    MS-Off Ver
    2010
    Posts
    18

    Re: Inserting Space In Cells

    Thank you!

    Quote Originally Posted by buran View Post
    what do you have in the cells? is it proper excel time value (i.e. decimal number between 0 and 1) or text string?
    If it is the former period is just a representation and even if you add space, it will reset to the same number format again. In this case just use custom number format to add space between number and the period.
    If it is string then you can use standard find/replace functionality in excel. i.e. replace "PM" with " PM"

+ 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: 2
    Last Post: 05-23-2014, 06:49 PM
  2. Macro for Inserting space in Cells
    By sanz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-19-2011, 07:18 AM
  3. Inserting space in a field
    By smselvi in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-28-2010, 02:53 AM
  4. [SOLVED] inserting a space in a number
    By Anthony in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-18-2006, 12:55 PM
  5. re inserting a 2 row space between data
    By hoganc in forum Excel General
    Replies: 1
    Last Post: 01-05-2005, 08:26 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