Re: Select specific text in cell
- From: "Rick Rothstein \(MVP - VB\)" <rick.newsNO.SPAM@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 16 Feb 2008 11:09:37 -0500
Actually, neither your one liner nor my longer variants will work if filename
includes a "-". For that, we need something like:
==============================
Option Explicit
Function fn(str As String) As String
Dim s1() As String
s1 = Split(str, "\")
s1 = Split(s1(UBound(s1)), "-")
ReDim Preserve s1(UBound(s1) - 1)
fn = Trim(Join(s1, "-"))
End Function
===========================
And, of course, the above would not work if the description itself contained a dash.
In thinking a little more about this question, it would appear, given the structure the OP has adopted, that **at least one** of the following must be true or the OP cannot have a fool-proof parser... the filename can never have a dash, or it can never have a space/dash/space combination in it, or it can never have just a plain space in it (which would further require a space always be present after the filename), or the description cannot have a backslash in it... one of these must be true in order to create a parser (one-liner or not) that would always work.
Rick
.
- Follow-Ups:
- Re: Select specific text in cell
- From: Ron Rosenfeld
- Re: Select specific text in cell
- From: Ron Rosenfeld
- Re: Select specific text in cell
- References:
- RE: Select specific text in cell
- From: FSt1
- Re: Select specific text in cell
- From: Ron Rosenfeld
- Re: Select specific text in cell
- From: Ron Rosenfeld
- Re: Select specific text in cell
- From: Rick Rothstein \(MVP - VB\)
- Re: Select specific text in cell
- From: Ron Rosenfeld
- Re: Select specific text in cell
- From: Rick Rothstein \(MVP - VB\)
- RE: Select specific text in cell
- Prev by Date: Re: Excel "can't find" double-clicked files
- Next by Date: Re: excel *** is starting from top right
- Previous by thread: Re: Select specific text in cell
- Next by thread: Re: Select specific text in cell
- Index(es):
Loading