+ Reply to Thread
Results 1 to 17 of 17

How to remove spaces between letters in a cell

  1. #1
    Registered User
    Join Date
    09-11-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    42

    How to remove spaces between letters in a cell

    Very urgent requirement

    could someone help me in finding how to remove spaces between letters in a cell example

    A B C Corporation = i want it to be ABC Corporation
    A B C L Corp = i want it to be ABCL Corporation
    A B Limited = AB Limited
    X 1 Technologies = x1 technologies
    N A F L Company = NAFL Company


    hope some one could help me asap.

    macro or formula = anything is good

  2. #2
    Forum Contributor stojko89's Avatar
    Join Date
    05-18-2009
    Location
    Maribor, Slovenia
    MS-Off Ver
    MS Office 365
    Posts
    913

    Re: How to remove spaces between letters in a cell

    The Ctrl+F the replace function could help you in one way but wouldn't make the A B C Corporation = ABC Corporation but ABCCorporation

  3. #3
    Forum Expert contaminated's Avatar
    Join Date
    05-07-2009
    Location
    Baku, Azerbaijan
    MS-Off Ver
    Excel 2013
    Posts
    1,430

    Re: How to remove spaces between letters in a cell

    Just press Ctrl + H In find what field type a space then press Replace All. See result.
    If it won't help, place cursor in find what field then hold down Alt key and type 0160 then press Replace All. See result.
    Last edited by contaminated; 10-11-2012 at 09:00 AM.
    Люди, питающие благие намерения, как раз и становятся чудовищами.

    Regards, ?Born in USSR?
    Vusal M Dadashev

    Baku, Azerbaijan

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: How to remove spaces between letters in a cell

    Try the attached
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    09-11-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: How to remove spaces between letters in a cell

    no..... it didnt hlp me in any ways

  6. #6
    Registered User
    Join Date
    09-11-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: How to remove spaces between letters in a cell

    let me check the attached sheet

  7. #7
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: How to remove spaces between letters in a cell

    nageshpolu,

    Detach/open workbook RemoveLeadingSpaces - nageshpolu - EF867473 - SDG15.xlsm and run the RemoveLeadingSpaces macro.


    If you want to use the macro on another workbook:


    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
    2. Open your workbook
    3. Press the keys ALT + F11 to open the Visual Basic Editor
    4. Press the keys ALT + I to activate the Insert menu
    5. Press M to insert a Standard Module
    6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
    7. Press the keys ALT + Q to exit the Editor, and return to Excel
    8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.


    Please Login or Register  to view this content.

    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm


    Then run the RemoveLeadingSpaces macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  8. #8
    Registered User
    Join Date
    09-11-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: How to remove spaces between letters in a cell

    hey thanks for that....

    but when i have account names like I T C ..... i am unable to remove the space between these characters
    and when i have company name like toshiba corporation ..... last word is getting deleted.

    could you please modify the sheet.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: How to remove spaces between letters in a cell

    Then replace the code with
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Cutter; 10-15-2012 at 01:03 PM. Reason: Removed whole post quote

  10. #10
    Registered User
    Join Date
    09-11-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: How to remove spaces between letters in a cell

    Hey dont mind one more small change required

    .... when i use this code... it is even closing last letter in the word...
    for example : abc bearings p = i am getting abc bearingsp but it shd be abc bearings p

    last one please dont mind.... thank you.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: How to remove spaces between letters in a cell

    try
    Please Login or Register  to view this content.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    09-11-2012
    Location
    Hyderabad
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: How to remove spaces between letters in a cell

    Man you are too genious.... thanks a ton!

    could you please suggest me some books where i can refer codes like this... so that i can start scripting the code

    and i have tried the last code but there is small bug in that too like

    abc p l is converting to abc pl

    so hope this would last bug clearance

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: How to remove spaces between letters in a cell

    If you goole with the key words like

    VBA Regular Expression Meta character

    You will find many good sites that you can learn from.

  14. #14
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: How to remove spaces between letters in a cell

    Quote Originally Posted by nageshpolu View Post
    and i have tried the last code but there is small bug in that too like

    abc p l is converting to abc pl

    so hope this would last bug clearance
    Then can you describe logically what should be done with the single letters?
    Upload many different patterns of sample data with the result would help.

  15. #15
    Registered User
    Join Date
    04-19-2012
    Location
    Nairobi, Kenya
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: How to remove spaces between letters in a cell

    Hi Jindon

    I want to adapt your code for my worksheet.

    The data was run through SPSS so everything is merged eg "Fanta Strawberry 40 ml" is now "FantaStrawberry40ml"

    What would be the code to merge everything in a cell?

  16. #16
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,633

    Re: How to remove spaces between letters in a cell

    Nairobi Nice

    You need to open a new thread for your own.(according to the rule here)
    When you open, attach a workbook with the data before/after format and it will help to understand your problem.

  17. #17
    Registered User
    Join Date
    04-19-2012
    Location
    Nairobi, Kenya
    MS-Off Ver
    Excel 2007
    Posts
    40

    Re: How to remove spaces between letters in a cell


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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