+ Reply to Thread
Results 1 to 6 of 6

Getting rid of extra space after cell contents?

  1. #1
    achidsey
    Guest

    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. #2
    JGeniti
    Guest

    Re: Getting rid of extra space after cell contents?

    Trim() will delete all trailing spaces.


  3. #3
    Jim Thomlinson
    Guest

    RE: 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. #4
    achidsey
    Guest

    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. #5
    Tom Ogilvy
    Guest

    Re: 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" <[email protected](notmorespam)> wrote in message
    news:[email protected]...
    >
    > 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. #6
    Dave Peterson
    Guest

    Re: 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" <[email protected](notmorespam)> wrote in message
    > news:[email protected]...
    > >
    > > 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1