Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. Test InsTr vs InStrRev for VBA:
  2.  
  3. Option Explicit
  4.  
  5. Sub test()
  6.  
  7. Dim testString As String
  8. testString = "123.456.789"
  9.  
  10. Dim inStrIndex As Long
  11. inStrIndex = InStr(1, testString, ".")
  12.  
  13. Dim inStrRevIndex As Long
  14. inStrRevIndex = InStrRev(testString, ".")
  15.  
  16. Debug.Print "Find ""."" in """ & testString & """"
  17. Debug.Print "InStr: " & inStrIndex
  18. Debug.Print "InStrRev: " & inStrRevIndex
  19.  
  20. End Sub
  21.  
  22.  
  23. Output:
  24.  
  25. Find "." in "123.456.789"
  26. InStr: 4
  27. InStrRev: 8
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement