View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.misc
Rick Rothstein \(MVP - VB\)[_36_] Rick Rothstein \(MVP - VB\)[_36_] is offline
external usenet poster
 
Posts: 1
Default Select specific text in cell

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.

Rick