Solved

How can I remove blank spaces in Excel?

Posted on 2002-03-21
3
4,106 Views
Last Modified: 2008-03-17
I have a very large file I imported into Excel but am having problems sorting it because many entries in cells begin with a space. How can I mass remove these unwanted spaces?
0
Comment
Question by:RAE
3 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 6887205
Hi RAE,

-lets say data start at row 2
-you can insert a column in front of the offending column say column A which will then become the B column
-then add this formula =LTRIM(B2) to the new column in A2
-now copy this formula down till the end of the column to trim
-to round it up select column A completely choose copy
-then goto the second column choose paste special | only values
-then delete the first column again

be sure to make a copy first of this sheet but it will work like this

HTH:Bruintje
0
 
LVL 5

Accepted Solution

by:
jklmn earned 100 total points
ID: 6887233
Hi RAE,

If you don't mind using VBA, you can select the range with the data in your sheet and run this simple code:

Sub Trim()
For Each acell In Selection.Cells
acell.Value = LTrim(acell.Value)
Next
End Sub
0
 

Author Comment

by:RAE
ID: 6887287
Thanks very much! It worked very well. (When I tried bruintje version I kept getting a #NAME? error)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction It seems that at least a couple of times per month, I answer a question that requires automating Outlook from another Microsoft Office application, usually (although not always) to send one or more email messages.  For example: …
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now