Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Ho to remove spaces before values?

Hi!
I have document with different values and some of them has spaces before
value. Text was imported into excel!
Is it possible somehow remove automatically all spaces from the beginnng of
the all cells?
Thank you!

Peter
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,101
Default Ho to remove spaces before values?

Use TRIM to remove all spaces except those between words i.e.

=Trim(A1) would remove all leading and trailing spaces

"Lion2004" wrote:

Hi!
I have document with different values and some of them has spaces before
value. Text was imported into excel!
Is it possible somehow remove automatically all spaces from the beginnng of
the all cells?
Thank you!

Peter

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 340
Default Ho to remove spaces before values?

Select column then DataText to ColumnsFixed WidthNext.
Remove any lines then click Finish

On 9 Mar, 11:39, Lion2004 wrote:
Hi!
I have document with different values and some of them has spaces before
value. Text was imported into excel!
Is it possible somehow remove automatically all spaces from the beginnng of
the all cells?
Thank you!

Peter



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 49
Default Ho to remove spaces before values?

=Trim(values) doesn't seem to work for me... hmmmmm


"Mike" wrote:

Use TRIM to remove all spaces except those between words i.e.

=Trim(A1) would remove all leading and trailing spaces

"Lion2004" wrote:

Hi!
I have document with different values and some of them has spaces before
value. Text was imported into excel!
Is it possible somehow remove automatically all spaces from the beginnng of
the all cells?
Thank you!

Peter

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Ho to remove spaces before values?

How did it not work?

Maybe what looks like spaces aren't really spaces????

You may want to try a macro from David McRitchie. Depending on what's in the
cell, it may work for you.
http://www.mvps.org/dmcritchie/excel/join.htm#trimall
(look for "Sub Trimall()"

If that doesn't work...

Chip Pearson has a very nice addin that will help determine what that
character(s) is:
http://www.cpearson.com/excel/CellView.htm

Then you can either fix it via a helper cell or a macro:

=substitute(a1,char(##),"")
or
=substitute(a1,char(##)," ")

Replace ## with the ASCII value you see in Chip's addin.

Or you could use a macro (after using Chip's CellView addin):

Option Explicit
Sub cleanEmUp()

Dim myBadChars As Variant
Dim myGoodChars As Variant
Dim iCtr As Long

myBadChars = Array(Chr(##), Chr(##)) '<--What showed up in CellView?

myGoodChars = Array(" ","") '<--what's the new character, "" for nothing?

If UBound(myGoodChars) < UBound(myBadChars) Then
MsgBox "Design error!"
Exit Sub
End If

For iCtr = LBound(myBadChars) To UBound(myBadChars)
ActiveSheet.Cells.Replace What:=myBadChars(iCtr), _
Replacement:=myGoodChars(iCtr), _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False
Next iCtr

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

PlayingToAudienceOfOne wrote:

=Trim(values) doesn't seem to work for me... hmmmmm

"Mike" wrote:

Use TRIM to remove all spaces except those between words i.e.

=Trim(A1) would remove all leading and trailing spaces

"Lion2004" wrote:

Hi!
I have document with different values and some of them has spaces before
value. Text was imported into excel!
Is it possible somehow remove automatically all spaces from the beginnng of
the all cells?
Thank you!

Peter


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove spaces phonenumbers Tromp Excel Discussion (Misc queries) 6 October 1st 09 12:05 AM
how do I remove leading spaces and leave the remianing spaces w Debi Excel Worksheet Functions 6 February 28th 07 03:29 PM
Remove all spaces in a cell... killertofu Excel Worksheet Functions 8 February 20th 06 08:17 PM
remove trailing spaces les8 Excel Discussion (Misc queries) 4 January 20th 06 03:55 PM
How do I remove spaces lovebaby Excel Discussion (Misc queries) 5 October 29th 05 02:08 PM


All times are GMT +1. The time now is 10:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"