Splitting string on the last delimeter

RocketRod

New member
Local time
Today, 14:01
Joined
Apr 24, 2007
Messages
8
I have a list of filepaths, one filepath in each cell. I want to extract the filename from the filepath and put it in a separate cell. Text to Columns will not work since I am only wanting to split the text after the last '\' and the filepaths vary in length.

Before:
Col1
C:\doc1.txt
C:\dir\doc2.txt
C:\dir\sub\doc3.txt

After:
Col1--------Col2
C:\ ---------doc1.txt
C:\dir\-------doc2.txt
C:\dir\sub\---doc3.txt

Thanks in advance,
Rod
 
See if this helps:
Code:
Public Function LastParam(InString As String) As String

LastParam = Right(InString, Len(InString) - InStrRev(InString, "\"))

End Function
 
Work great!! Thanks for the quick response!
 

Users who are viewing this thread

Back
Top Bottom