Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Getting rid of extra space after cell contents?


Friends,

I have a column of data in my spreadsheet that has extra spaces after the
data in each cell. For example, rather than having "DELL" it has "DELL ".

What is the function to get rid of the extra spaces?

Thanks,

Alan



--
achidsey
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Getting rid of extra space after cell contents?

Trim() will delete all trailing spaces.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Getting rid of extra space after cell contents?

=Trim(A1)

Where A1 contains the word "Dell "

In code it would look like this

sheet1.range("A1").value = trim(sheet1.range("A1").value)
--
HTH...

Jim Thomlinson


"achidsey" wrote:


Friends,

I have a column of data in my spreadsheet that has extra spaces after the
data in each cell. For example, rather than having "DELL" it has "DELL ".

What is the function to get rid of the extra spaces?

Thanks,

Alan



--
achidsey

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 100
Default Thanks for the help


J and Jim,

Thanks for your assistance

Alan


--
achidsey


"achidsey" wrote:


Friends,

I have a column of data in my spreadsheet that has extra spaces after the
data in each cell. For example, rather than having "DELL" it has "DELL ".

What is the function to get rid of the extra spaces?

Thanks,

Alan



--
achidsey

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Thanks for the help

Its probably a trivial point in this case, but there are three types of trim
in VBA: From the help:

LTrim, RTrim, and Trim Functions
Returns a Variant (String) containing a copy of a specified string without
leading spaces (LTrim), trailing spaces (RTrim), or both leading and
trailing spaces (Trim).

--
regards,
Tom Ogilvy

"achidsey" (notmorespam) wrote in message
...

J and Jim,

Thanks for your assistance

Alan


--
achidsey


"achidsey" wrote:


Friends,

I have a column of data in my spreadsheet that has extra spaces after

the
data in each cell. For example, rather than having "DELL" it has "DELL

".

What is the function to get rid of the extra spaces?

Thanks,

Alan



--
achidsey





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Thanks for the help

And just to add to Tom's trivial point, an even more trivial point...

If the OP wants to remove leading, trailing and multiple repeated internal
spaces, the OP could use:

application.trim()

" this is a test "
would become
"this is a test"

(quotes used just for readability.)

Tom Ogilvy wrote:

Its probably a trivial point in this case, but there are three types of trim
in VBA: From the help:

LTrim, RTrim, and Trim Functions
Returns a Variant (String) containing a copy of a specified string without
leading spaces (LTrim), trailing spaces (RTrim), or both leading and
trailing spaces (Trim).

--
regards,
Tom Ogilvy

"achidsey" (notmorespam) wrote in message
...

J and Jim,

Thanks for your assistance

Alan


--
achidsey


"achidsey" wrote:


Friends,

I have a column of data in my spreadsheet that has extra spaces after

the
data in each cell. For example, rather than having "DELL" it has "DELL

".

What is the function to get rid of the extra spaces?

Thanks,

Alan



--
achidsey


--

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
merging spreadsheets/one has extra space in each cell Julie Excel Discussion (Misc queries) 2 March 25th 08 05:53 PM
space before cell contents BNT1 via OfficeKB.com Excel Worksheet Functions 2 February 22nd 08 02:30 PM
space before cell contents BNT1 via OfficeKB.com Excel Worksheet Functions 0 February 22nd 08 02:07 PM
How do I delete an extra space in every cell in a column? iamjbunni Excel Discussion (Misc queries) 2 April 21st 06 06:14 PM
If it's not a space, return the cell contents. Gee... Excel Worksheet Functions 3 January 3rd 06 11:50 PM


All times are GMT +1. The time now is 10:59 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"