Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
backwards find function to find character in a string of text
Hello All,
I'm having a problem doing something that seems like it would be relatively simple....I have a value in a cell which is actually the directory path and name of another workbook (i.e. \\Server1\clients\clientA\financials\financialstat ement.xls) and I would like to get just the file name by itself. The name "financialstatements" will vary, so I will need a function/macro that can take whatever is between the last "\" and ".xls" and return that value to a cell. I have been unable to use the right function with the find function because the find function starts at the beginning of the string and therefore returns the first "\". Is there a way to start from the end of the string instead of the beginning? Thanks in advance, Ashleigh |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
backwards find function to find character in a string of text
Ashleigh,
In Excel 2000 and later, you can use the InStrRev function to search right to left. E.g., Dim Pos As Long Pos = InStrRev(S, "\", -1, vbTextCompare) -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Ashleigh K." wrote in message ... Hello All, I'm having a problem doing something that seems like it would be relatively simple....I have a value in a cell which is actually the directory path and name of another workbook (i.e. \\Server1\clients\clientA\financials\financialstat ement.xls) and I would like to get just the file name by itself. The name "financialstatements" will vary, so I will need a function/macro that can take whatever is between the last "\" and ".xls" and return that value to a cell. I have been unable to use the right function with the find function because the find function starts at the beginning of the string and therefore returns the first "\". Is there a way to start from the end of the string instead of the beginning? Thanks in advance, Ashleigh |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
FIND 2nd character in a string | Excel Worksheet Functions | |||
find a character in a string | Excel Discussion (Misc queries) | |||
Find last occurance of character in text string | Excel Worksheet Functions | |||
Find nth instance of a character in a string | Excel Discussion (Misc queries) | |||
How find character position # in string from right end? Or how get range row num | Excel Programming |