title: Scan a filename and extract a three digit character after a delimiter
body: <p>I having some trouble with Excel VBA Macros. Basically I need to extract a sheet number from a file name and the naming convention is not always followed. For example:</p>
  
  <pre><code>(Plant Number - Index Letter - Drawing Number - Sheet Number) 
  000-M-40324-002
  3-PS-17345-001
  010-S-59239-
  10-K6-59235-2M
  012-J-59423-103-A
  </code></pre>
  
  <p>The number I need to get is mostly always the last three digits in the name but not always and sometimes it's moved out by more than the expected dashes.</p>
  
  <p>I have tried a VBA function. but my programming skills are lacking now.</p>
  
  <p>Script:</p>
  
  <pre><code>Public Function GetWSheetNumber(s As String) As String
  Dim v As String
  For i = 1 To Len(s)
      ch = Mid(s, i, 1)
      If IsNumeric(ch) Then
          v = v &amp; ch
      Else
          v = v &amp; " "
      End If
  Next i
  
  v = Application.WorksheetFunction.Trim(v)
  
  ary = Split(v, " ")
  For Each a In ary
      If Len(a) = 3 Then
          GetWSheetNumber = a
          Exit Function
      End If
  Next a
  
  GetWSheetNumber = ""
  End Function
  </code></pre>
  
  <p>It is always the last three numbers. There is always a hyphen to separate the values. The expected results from my sample are as follows: </p>
  
  <pre><code>000-M-40324-002     - 002
  3-PS-17345-001       - 001
  010-S-59239-           - No Value
  10-K6-59235-2M      - No Value
  012-J-59423-103-A  - 103
  </code></pre>