+ Reply to Thread
Results 1 to 3 of 3

Macro for suppressing file name in a path

  1. #1
    Registered User
    Join Date
    03-08-2011
    Location
    Rochester, NY
    MS-Off Ver
    Excel 2003
    Posts
    1

    Macro for suppressing file name in a path

    I have a worksheet that includes a column called path with path names for files.

    We would like a macro that would create a new column that has that path minus the file name.

    As an example, it would take this:

    C:\Windows\Help\Windows\ar-SA\virtualpc.h1s
    C:\Windows\Help\Windows\cs-CZ\virtualpc.h1s
    C:\Windows\Globalization\Sorting\SortDefault.nls

    And create a column with this:

    C:\Windows\Help\Windows\ar-SA\
    C:\Windows\Help\Windows\cs-CZ\
    C:\Windows\Globalization\Sorting\

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2003
    Location
    British Columbia , Canada
    MS-Off Ver
    03,07,10,13
    Posts
    727

    Re: Macro for suppressing file name in a path

    With this solution you "select" the cells with the paths you want to convert, then run macro, ... the results will be displayed in the next column over.

    Please Login or Register  to view this content.
    Last edited by nimrod; 03-08-2011 at 04:22 PM.

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro for suppressing file name in a path

    Why a macro?

    =LEFT(A1, FIND(">", SUBSTITUTE(A1, "\", ">", LEN(A1) - LEN(SUBSTITUTE(A1, "\", "")))))
    Entia non sunt multiplicanda sine necessitate

+ 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