+ Reply to Thread
Results 1 to 6 of 6

Replace "A " by "A" in a cell

  1. #1
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Replace "A " by "A" in a cell

    Good morning everyone,

    I have attached a simplified sample of my problem.

    I need to filter people (Name) by categories. (eg 2 categories prossible)
    1) category A -> "A"
    2) category B -> "B"

    The problem is that I received these names with their associated categories from third parties and instead of having "A" I often have "A " or " A" or " a ".
    how could I normalized all of them to "A" without any space.

    thanks you for your time.
    -Phil
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Replace "A " by "A" in a cell

    Remove the spaces.

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Replace "A " by "A" in a cell

    Another:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Replace "A " by "A" in a cell

    thanks to both of you.

    .replace and application.Trim() both serves my purposes.

    Very helpful, I always use workarounds but this address my issue permanently.
    -Phil

    PS: to AB33, when using ".value", I usually put a range before .value. I understand that we are within a "with ... end with Statement", but does it apply the trim function to each cell simultaneously or is it actually doing a loop very quickly?

  5. #5
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Replace "A " by "A" in a cell

    I used current region ,instead of range. The code applies to the region with out looping.

  6. #6
    Forum Contributor
    Join Date
    06-24-2013
    Location
    Berlin
    MS-Off Ver
    Excel 2007
    Posts
    188

    Re: Replace "A " by "A" in a cell

    thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. replace all defined range names in the sheet that start with "Street" to "Road"
    By matrex in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-04-2016, 08:53 AM
  2. Replies: 4
    Last Post: 11-17-2013, 12:05 PM
  3. [SOLVED] How to USE """"" cells count """"" change font color
    By austin123456 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2013, 06:14 AM
  4. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  5. Replies: 7
    Last Post: 05-13-2006, 05:02 PM

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