ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Getting rid of extra space after cell contents? (https://www.excelbanter.com/excel-programming/337144-getting-rid-extra-space-after-cell-contents.html)

achidsey

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

jgeniti

Getting rid of extra space after cell contents?
 
Trim() will delete all trailing spaces.


Jim Thomlinson[_4_]

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


achidsey

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


Tom Ogilvy

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




Dave Peterson

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


All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com