+ Reply to Thread
Results 1 to 5 of 5

Reducing 2 spaces, down to 1

  1. #1
    Registered User
    Join Date
    02-08-2009
    Location
    New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    3

    Reducing 2 spaces, down to 1

    Hi

    I am a VBA novice, and would appreciate your help trying to get a solution to my problem. I would like to remove all double spaces, and replace them with a single space within a worksheet (or just column B). The code needs to repeat until there are no more double spaces left.

    What I have so far is this:

    Please Login or Register  to view this content.
    The problem is I get a run-time error '94', and I really don't know how to fix it. Can anyone help?

    Thanks in advance.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: Reducing 2 spaces, down to 1

    Select a range of cells and run this:
    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Reducing 2 spaces, down to 1

    Hi there,

    The following should do the job for cells B2 to B[lngLastRow]:

    Please Login or Register  to view this content.
    HTH

    Robert

  4. #4
    Registered User
    Join Date
    02-08-2009
    Location
    New Zealand
    MS-Off Ver
    Excel 2003
    Posts
    3

    Smile Re: Reducing 2 spaces, down to 1

    Thanks so much. Both pieces of code work really well.

    Thanks again.

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: Reducing 2 spaces, down to 1

    You're welcome. Please ensure you mark the thread as [SOLVED]

+ 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