Posted By

lolrenx on 12/20/12


Tagged

String excel separator vba


Versions (?)

Left of


 / Published in: Visual Basic
 

Left of separator

  1. Option Explicit
  2. Option Compare Text
  3.  
  4.  
  5. ' UDF
  6. Public Function LeftOf(ByVal haystack As String, ByVal needle As String) As String
  7. Dim i As Long
  8. i = InStr(haystack, needle)
  9. If i > 0 Then
  10. LeftOf = Left(haystack, i - 1)
  11. Else
  12. LeftOf = haystack
  13. End If
  14. End Function

Report this snippet  

You need to login to post a comment.