+ Reply to Thread
Results 1 to 3 of 3

Macro to Parse Company Names

  1. #1
    Registered User
    Join Date
    09-04-2012
    Location
    Toronto
    MS-Off Ver
    Excel 2010
    Posts
    1

    Macro to Parse Company Names

    I'm building a Macro to parse company names in an excel database. The purpose is to remove common company extensions such as Inc, Ltd, Co, Corp, etc. As an example, ABC Inception Ltd. should becomes ABC Inception. The problem I'm having is that I can't seem to eliminate spaces at the end of the fields and I can't get the macro to ignore "Inc" when its part of a larger word so that my actual output for the preceding example would be "ABC eption ".

    The code fragment I'm using looks like this:

    Range("C:C").Replace What:="inc", Replacement:="", LookAt:=xlPart, SearchOrder _
    :=xlByColumns, MatchCase:=False, SearchFormat:=False, ReplaceFormat:= _
    False

    Thoughts?

  2. #2
    Registered User
    Join Date
    09-14-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Macro to Parse Company Names

    Read the company name from the right for
    Inc
    Inc.
    Ltd
    Ltd.
    etc...
    Depending if it's 4 or 3 characters, use len and mid to replace the cel value.

  3. #3
    Registered User
    Join Date
    09-14-2012
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010
    Posts
    45

    Re: Macro to Parse Company Names

    Something like this...
    Please Login or Register  to view this content.

+ 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