+ Reply to Thread
Results 1 to 3 of 3

Removing blank spaces before and after in a cell using VBA

  1. #1
    Forum Contributor
    Join Date
    08-15-2006
    Location
    USA
    MS-Off Ver
    Office 365, 64 bit
    Posts
    372

    Removing blank spaces before and after in a cell using VBA

    I have a column where users paste a list of numbers (up to 120). It starts at D4 and ends at D123, column D. Sample numbers are: 11111, 11111a, 22222c. Sometimes the users paste numbers and they have spaces either before or after the numbers... Is there a simple code that will solve this for only column D from D4 to D123?

    Thanks...
    Last edited by rz6657; 06-27-2013 at 04:59 PM.

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Removing blank spaces before and after in a cell using VBA

    Hi

    In D1 type " 1234 " but without the inverted commas. [ space, 1, 2, 3, 4 space.
    in e1 type =trim(D1) This will remove any useless spaces.
    in f1 type =len(e1) This proves that the spaces have been removed.

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Removing blank spaces before and after in a cell using VBA

    If you want to do this using VBA then then.

    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)

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