Take a look in VBA's help for:
Trim, LTrim, and RTrim
Gord used Application.Trim which is a lot like VBA's trim--except that it gets
rid of extra internal spaces, too. (VBA's Trim just touches the left and right
edges).
application.trim(" Todd Huddlestine ")
and
trim(" Todd Huddlestine ")
Would return different strings.
Todd Huttenstine wrote:
I have a very big range of data on a worksheet. The range
is located on worksheet Renewals A:F. Another worksheet
Wkly Renewals has a pivot table referencing that range.
Some values in the range may have a space (" ") at the end
of the value and needs to be removed.
For example cell D205 should be "Todd Huttenstine" but
instead it is "Todd Huttenstine " or cell D206 may have
the value "Randy " instead of "randy". I need these
spaces removed with code because my pivot table is showing
duplicates due to this space. The pivot tables looks at
this as 2 different values because technically the space
makes it that way.
Any help is appreciated.
Todd Huttenstine
--
Dave Peterson