Posted By

lolrenx on 12/20/12


Tagged

String excel separator vba


Versions (?)

Right of Last


 / Published in: Visual Basic
 

Right of last instance

  1. Option Explicit
  2. Option Compare Text
  3.  
  4.  
  5. ' UDF
  6. ' Right of last instance
  7. Public Function RightOfLast(ByVal haystack As String, ByVal needle As String) As String
  8. Dim i As Long
  9. i = InStrRev(haystack, needle)
  10. If i > 0 Then
  11. RightOfLast = Mid(haystack, i + Len(needle))
  12. Else
  13. RightOfLast = ""
  14. End If
  15. End Function

Report this snippet  

You need to login to post a comment.